@@ -2019,7 +2019,7 @@ changes:
20192019 description: Marking the API stable.
20202020-->
20212021
2022- * ` stream ` {Stream|Iterable|AsyncIterable |Function}
2022+ * ` stream ` {Writable|Duplex|WritableStream|TransformStream |Function}
20232023* ` options ` {Object}
20242024 * ` signal ` {AbortSignal} allows destroying the stream if the signal is
20252025 aborted.
@@ -2038,13 +2038,18 @@ async function* splitToWords(source) {
20382038 }
20392039}
20402040
2041- const wordsStream = Readable .from ([' this is ' , ' compose as operator ' ]).compose (splitToWords);
2041+ const wordsStream = Readable .from ([' text passed through ' , ' composed stream ' ]).compose (splitToWords);
20422042const words = await wordsStream .toArray ();
20432043
2044- console .log (words); // prints ['this ', 'is ', 'compose ', 'as ', 'operator ']
2044+ console .log (words); // prints ['text ', 'passed ', 'through ', 'composed ', 'stream ']
20452045```
20462046
2047- See [ ` stream.compose ` ] [ ] for more information.
2047+ ` readable.compose(s) ` is equivalent to ` stream.compose(readable, s) ` .
2048+
2049+ This method also allows for an {AbortSignal} to be provided, which will destroy
2050+ the composed stream when aborted.
2051+
2052+ See [ ` stream.compose(...streams) ` ] [ ] for more information.
20482053
20492054##### ` readable.iterator([options]) `
20502055
@@ -3040,7 +3045,8 @@ await finished(compose(s1, s2, s3));
30403045console .log (res); // prints 'HELLOWORLD'
30413046```
30423047
3043- See [ ` readable.compose(stream) ` ] [ ] for ` stream.compose ` as operator.
3048+ For convenience, the [ ` readable.compose(stream) ` ] [ ] method is available on
3049+ {Readable} and {Duplex} streams as a wrapper for this function.
30443050
30453051### ` stream.isErrored(stream) `
30463052
@@ -4974,7 +4980,7 @@ contain multi-byte characters.
49744980[` readable .setEncoding ()` ]: #readablesetencodingencoding
49754981[` stream .Readable .from ()` ]: #streamreadablefromiterable-options
49764982[` stream .addAbortSignal ()` ]: #streamaddabortsignalsignal-stream
4977- [` stream .compose ` ]: #streamcomposestreams
4983+ [` stream .compose ( ... streams) ` ]: #streamcomposestreams
49784984[` stream .cork ()` ]: #writablecork
49794985[` stream .duplexPair ()` ]: #streamduplexpairoptions
49804986[` stream .finished ()` ]: #streamfinishedstream-options-callback
0 commit comments