@@ -618,6 +618,12 @@ instance, when the `readable.resume()` method is called without a listener
618618attached to the ` 'data' ` event, or when a ` 'data' ` event handler is removed
619619from the stream.
620620
621+ Adding a [ ` 'readable' ` ] [ ] event handler automatically make the stream to
622+ stop flowing, and the data to be consumed via
623+ [ ` readable.read() ` ] [ stream-read ] . If the [ ` 'readable' ` ] event handler is
624+ removed, then the stream will start flowing again if there is a
625+ [ ` 'data' ` ] [ ] event handler.
626+
621627#### Three States
622628
623629The "two modes" of operation for a ` Readable ` stream are a simplified
@@ -666,12 +672,15 @@ within the streams internal buffer.
666672The ` Readable ` stream API evolved across multiple Node.js versions and provides
667673multiple methods of consuming stream data. In general, developers should choose
668674* one* of the methods of consuming data and * should never* use multiple methods
669- to consume data from a single stream.
675+ to consume data from a single stream. Specifically, using a combination
676+ of ` on('data') ` , ` on('readable') ` , ` pipe() ` or async iterators could
677+ lead to unintuitive behavior.
670678
671679Use of the ` readable.pipe() ` method is recommended for most users as it has been
672680implemented to provide the easiest way of consuming stream data. Developers that
673681require more fine-grained control over the transfer and generation of data can
674- use the [ ` EventEmitter ` ] [ ] and ` readable.pause() ` /` readable.resume() ` APIs.
682+ use the [ ` EventEmitter ` ] [ ] and ` readable.on('readable') ` /` readable.read() `
683+ or the ` readable.pause() ` /` readable.resume() ` APIs.
675684
676685#### Class: stream.Readable
677686<!-- YAML
@@ -825,7 +834,11 @@ result in increased throughput.
825834
826835If both ` 'readable' ` and [ ` 'data' ` ] [ ] are used at the same time, ` 'readable' `
827836takes precedence in controlling the flow, i.e. ` 'data' ` will be emitted
828- only when [ ` stream.read() ` ] [ stream-read ] is called.
837+ only when [ ` stream.read() ` ] [ stream-read ] is called. The
838+ ` readableFlowing ` property would become ` false ` .
839+ If there are ` 'data' ` listeners when ` 'readable' ` is removed, the stream
840+ will start flowing, i.e. ` 'data' ` events will be emitted without calling
841+ ` .resume() ` .
829842
830843##### readable.destroy([ error] )
831844<!-- YAML
@@ -887,6 +900,9 @@ readable.on('data', (chunk) => {
887900});
888901```
889902
903+ The ` readable.pause() ` method has no effect if there is a ` 'readable' `
904+ event listener.
905+
890906##### readable.pipe(destination[ , options] )
891907<!-- YAML
892908added: v0.9.4
0 commit comments