-
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
doc: correct cleanup
option in stream.(promises.)finished
#55043
doc: correct cleanup
option in stream.(promises.)finished
#55043
Conversation
9ca144e
to
8db8ed6
Compare
8db8ed6
to
a3a8e0c
Compare
* `error` {boolean|undefined} | ||
* `readable` {boolean|undefined} | ||
* `writable` {boolean|undefined} | ||
* `signal`: {AbortSignal|undefined} | ||
* `signal` {AbortSignal|undefined} | ||
* `cleanup` {boolean|undefined} If `true`, removes the listeners registered by | ||
this function before the promise is fulfilled. **Default:** `false`. |
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.
Don't think that the convention for options parameter types is to include undefined
?
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.
IMO that's an issue for a different PR because this PR follows the same convention as the rest of the parameters.
Landed in 7f48081 |
PR-URL: nodejs#55043 Refs: nodejs#44862 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#55043 Refs: nodejs#44862 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Please check my working, but my reading of
stream.finished()
andstream.promises.finished()
is that:stream.finished()
iseos()
in internal/streams/end-of-stream, which returns a cleanup function that can be called by the user to remove the event listeners added byfinished()
stream.promises.finished()
isfinished()
in internal/streams/end-of-stream, which accepts the boolean optionoptions.cleanup
, which will call the cleanup function returned byeos()
before the returned Promise is resolved or rejectedWhen
options.cleanup
was added in #44862, the documentation for it appears to have been added to the callback API function rather than the promises API function.This change moves it to the correct place, and documents the context of its usage, similar to the equivalent documentation for the callback API function.
Refs: #44862