-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream,doc: require finished callback and add options docs #21058
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content LGTM. Some formatting/grammar changes requested.
doc/api/stream.md
Outdated
<!-- YAML | ||
added: v10.0.0 | ||
--> | ||
|
||
* `stream` {Stream} A readable and/or writable stream. | ||
* `options` {Object} | ||
* `error` {boolean} If set to `false` a call to emit('error', err) is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comma after `false`
, and maybe then
as well:
If set to `false`, then a call to ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks around emit('error', err)
doc/api/stream.md
Outdated
<!-- YAML | ||
added: v10.0.0 | ||
--> | ||
|
||
* `stream` {Stream} A readable and/or writable stream. | ||
* `options` {Object} | ||
* `error` {boolean} If set to `false` a call to emit('error', err) is not | ||
treated finished. **Default**: `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing word or something. treated as finished
perhaps?
doc/api/stream.md
Outdated
* `options` {Object} | ||
* `error` {boolean} If set to `false` a call to emit('error', err) is not | ||
treated finished. **Default**: `true`. | ||
* `readable` {boolean} When set to `false` the callback will be called after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing with the comma and probably a then
as well.
doc/api/stream.md
Outdated
* `readable` {boolean} When set to `false` the callback will be called after | ||
the stream ended but the stream might still be readable. **Default**: | ||
`true`. | ||
* `writable` {boolean} When set to `false` the callback will be called after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing with the comma and probably a then
as well.
doc/api/stream.md
Outdated
* `error` {boolean} If set to `false` a call to emit('error', err) is not | ||
treated finished. **Default**: `true`. | ||
* `readable` {boolean} When set to `false` the callback will be called after | ||
the stream ended but the stream might still be readable. **Default**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ended
-> ends
doc/api/stream.md
Outdated
the stream ended but the stream might still be readable. **Default**: | ||
`true`. | ||
* `writable` {boolean} When set to `false` the callback will be called after | ||
the stream ended but the stream might still be writable. **Default**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ended
-> ends
When we change a heading in the docs, we need to check if there are links to this heading in all the docs (copy the old hash from the old HTML doc and grep this hash in https://github.com/nodejs/node/blame/master/doc/api/stream.md#L2504 |
LGTM on the changes mentioned from me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Make the callback mandatory as mostly done in all other Node.js callback APIs so users explicitly have to decide what to do in error cases.
When originally implemented it was missed that Stream.finished() has an optional options object. This adds the docs to those.
27c3883
to
c310236
Compare
@Trott @nodejs/streams PTAL I addressed the comments and added some tests. |
Still LGTM, this can land. |
@nodejs/tsc PTAL |
@BridgeAR still lgtm |
Make the callback mandatory as mostly done in all other Node.js callback APIs so users explicitly have to decide what to do in error cases. This also documents the options for `Stream.finished()`. When originally implemented it was missed that Stream.finished() has an optional options object. PR-URL: nodejs#21058 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
Landed in 36468ca 🎉 |
I just stumbled upon missing documentation about the
Stream.finished()
options. We should also make the callback mandatory as already documented. Right now there would be a no op added in case a falsy value is provided for the callback.Test cases are missing and I'll add some later on (if someone wants to add them, I am also more than happy about that ;-) please feel free to just directly pushing on this branch).Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes