Repository navigation
Closed
Labels
streamIssues and PRs related to Node.js streams.
Description
The intention of readable.compose() is that the method returns the Duplex from the internals/streams/compose function unscathed.
Unfortunately, because it's merged onto Readable.prototype as a "stream-returning operator":
Lines 64 to 83 in 8a3482e
| const streamKeys = ObjectKeys(streamReturningOperators); | |
| for (let i = 0; i < streamKeys.length; i++) { | |
| const key = streamKeys[i]; | |
| const op = streamReturningOperators[key]; | |
| function fn(...args) { | |
| if (new.target) { | |
| throw new ERR_ILLEGAL_CONSTRUCTOR(); | |
| } | |
| return Stream.Readable.from(ReflectApply(op, this, args)); | |
| } | |
| ObjectDefineProperty(fn, 'name', { __proto__: null, value: op.name }); | |
| ObjectDefineProperty(fn, 'length', { __proto__: null, value: op.length }); | |
| ObjectDefineProperty(Stream.Readable.prototype, key, { | |
| __proto__: null, | |
| value: fn, | |
| enumerable: false, | |
| configurable: true, | |
| writable: true, | |
| }); | |
| } |
...its return value is passed via Readable.from(), clobbering the Duplex into a Readable.
The .compose() operator needs specifically to bypass this mechanism.
Refs: #44937
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to Node.js streams.
Activity
BetaDude40 commentedon Oct 5, 2024
I can try and work on this
stream: do not pass `readable.compose()` output via `Readable.from()`
stream: do not pass `readable.compose()` output via `Readable.from()`
stream: do not pass `readable.compose()` output via `Readable.from()`
stream: do not pass `readable.compose()` output via `Readable.from()`
stream: do not pass `readable.compose()` output via `Readable.from()`
stream: do not pass `readable.compose()` output via `Readable.from()`