@@ -2007,7 +2007,7 @@ changes:
20072007 description: Marking the API stable.
20082008-->
20092009
2010- * ` stream ` {Stream|Iterable|AsyncIterable |Function}
2010+ * ` stream ` {Writable|Duplex|WritableStream|TransformStream |Function}
20112011* ` options ` {Object}
20122012 * ` signal ` {AbortSignal} allows destroying the stream if the signal is
20132013 aborted.
@@ -2026,13 +2026,18 @@ async function* splitToWords(source) {
20262026 }
20272027}
20282028
2029- const wordsStream = Readable .from ([' this is ' , ' compose as operator ' ]).compose (splitToWords);
2029+ const wordsStream = Readable .from ([' text passed through ' , ' composed stream ' ]).compose (splitToWords);
20302030const words = await wordsStream .toArray ();
20312031
2032- console .log (words); // prints ['this ', 'is ', 'compose ', 'as ', 'operator ']
2032+ console .log (words); // prints ['text ', 'passed ', 'through ', 'composed ', 'stream ']
20332033```
20342034
2035- See [ ` stream.compose ` ] [ ] for more information.
2035+ ` readable.compose(s) ` is equivalent to ` stream.compose(readable, s) ` .
2036+
2037+ This method also allows for an {AbortSignal} to be provided, which will destroy
2038+ the composed stream when aborted.
2039+
2040+ See [ ` stream.compose(...streams) ` ] [ ] for more information.
20362041
20372042##### ` readable.iterator([options]) `
20382043
@@ -3026,7 +3031,8 @@ await finished(compose(s1, s2, s3));
30263031console .log (res); // prints 'HELLOWORLD'
30273032```
30283033
3029- See [ ` readable.compose(stream) ` ] [ ] for ` stream.compose ` as operator.
3034+ For convenience, the [ ` readable.compose(stream) ` ] [ ] method is available on
3035+ {Readable} and {Duplex} streams as a wrapper for this function.
30303036
30313037### ` stream.isErrored(stream) `
30323038
@@ -4945,7 +4951,7 @@ contain multi-byte characters.
49454951[` readable .setEncoding ()` ]: #readablesetencodingencoding
49464952[` stream .Readable .from ()` ]: #streamreadablefromiterable-options
49474953[` stream .addAbortSignal ()` ]: #streamaddabortsignalsignal-stream
4948- [` stream .compose ` ]: #streamcomposestreams
4954+ [` stream .compose ( ... streams) ` ]: #streamcomposestreams
49494955[` stream .cork ()` ]: #writablecork
49504956[` stream .duplexPair ()` ]: #streamduplexpairoptions
49514957[` stream .finished ()` ]: #streamfinishedstream-options-callback
0 commit comments