Skip to content
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

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

Renegade334
Copy link
Contributor

@Renegade334 Renegade334 commented Sep 21, 2024

Please check my working, but my reading of stream.finished() and stream.promises.finished() is that:

  • stream.finished() is eos() in internal/streams/end-of-stream, which returns a cleanup function that can be called by the user to remove the event listeners added by finished()
  • stream.promises.finished() is finished() in internal/streams/end-of-stream, which accepts the boolean option options.cleanup, which will call the cleanup function returned by eos() before the returned Promise is resolved or rejected

When 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

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem. labels Sep 21, 2024
@Renegade334 Renegade334 force-pushed the docs-stream-finished branch 2 times, most recently from 9ca144e to 8db8ed6 Compare September 21, 2024 14:25
Comment on lines 270 to +275
* `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`.
Copy link
Contributor Author

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?

Copy link
Member

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.

@RedYetiDev RedYetiDev added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 24, 2024
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 25, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 25, 2024
@nodejs-github-bot nodejs-github-bot merged commit 7f48081 into nodejs:main Sep 25, 2024
19 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 7f48081

targos pushed a commit that referenced this pull request Oct 4, 2024
PR-URL: #55043
Refs: #44862
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95 aduh95 mentioned this pull request Oct 9, 2024
@Renegade334 Renegade334 deleted the docs-stream-finished branch October 25, 2024 23:15
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#55043
Refs: nodejs#44862
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants