-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
stream: do not pass readable.compose() output via Readable.from()
#60907
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: do not pass readable.compose() output via Readable.from()
#60907
Conversation
|
Review requested:
|
| --> | ||
|
|
||
| * `stream` {Stream|Iterable|AsyncIterable|Function} | ||
| * `stream` {Writable|Duplex|WritableStream|TransformStream|Function} |
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.
There's no behaviour change here. Technically iterables are valid as "transformers" in stream.compose(), but since they ignore the source stream output entirely, it seems pointless to be documenting them here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60907 +/- ##
==========================================
+ Coverage 88.51% 88.52% +0.01%
==========================================
Files 703 703
Lines 208432 208428 -4
Branches 40200 40200
==========================================
+ Hits 184502 184520 +18
+ Misses 15957 15909 -48
- Partials 7973 7999 +26
🚀 New features to boost your workflow:
|
47933e0 to
2aa0aa9
Compare
2aa0aa9 to
9cc1c88
Compare
|
cc @nodejs/streams – believe this is good to go, but would be grateful for some more eyes. |
mcollina
left a comment
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
|
Landed in 5e677d6 |
readable.compose()was intended to return the Duplex constructed bystream.compose(), and is documented as such.However, because it was added as a "stream-returning operator", its output is being passed via
Readable.from(), which constructs a new object-mode Readable by wrapping the async iterator of the composed Duplex. This is inefficient in the best case, but causes breakage in a load of others:stream.compose().This change gets rid of the "operator" semantics for
readable.compose(), and makes it a standalone method which returns the unaltered composed Duplex stream fromstream.compose().Fixes: #55203