-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: clarify recommendations in stream.md #42555
Conversation
implemented to provide the easiest way of consuming stream data. Developers that | ||
require more fine-grained control over the transfer and generation of data can | ||
use the [`EventEmitter`][] and `readable.on('readable')`/`readable.read()` | ||
`readable.pipe()` provides the easiest way to consume stream data. Developers |
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.
This statement has not been true for years (at least since we had async/iterators support).
I would remove these 3 lines altogether or maybe replace them with:
readable.pipe
is a low-level API to connect streams. It is preferred to use [pipeline
][] or [compose
][] to connect streams. For convenience you can iterate streams with for... await
loops or .toArray()
a stream which is convenient but not as performant.
Or a better phrasing of that
Commit Queue failed- Loading data for nodejs/node/pull/42555 FetchError: Invalid response body while trying to fetch https://api.github.com/graphql: Premature close at consumeBody (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/node_modules/node-fetch/src/body.js:234:60) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Response.text (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/node_modules/node-fetch/src/body.js:158:18) at async Request.json (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/lib/request.js:49:18) at async Request.query (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/lib/request.js:107:20) at async Request.queryAll (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/lib/request.js:134:20) at async Request.gql (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/lib/request.js:64:22) at async PRData.getComments (file:///opt/hostedtoolcache/node/16.14.0/x64/lib/node_modules/node-core-utils/lib/pr_data.js:97:21) at async Promise.all (index 2) at async Promise.all (index 1) { type: 'system', errno: 'ERR_STREAM_PREMATURE_CLOSE', code: 'ERR_STREAM_PREMATURE_CLOSE', erroredSysCall: undefined }https://github.com/nodejs/node/actions/runs/2084348110 |
PR-URL: nodejs#42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Landed in b717795 |
PR-URL: nodejs#42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: #42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: nodejs#42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: #42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: #42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: #42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: #42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
PR-URL: nodejs/node#42555 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
No description provided.