@@ -595,17 +595,28 @@ possible states:
595
595
* ` readable._readableState.flowing = true `
596
596
597
597
When ` readable._readableState.flowing ` is ` null ` , no mechanism for consuming the
598
- streams data is provided so the stream will not generate its data.
599
-
600
- Attaching a listener for the ` 'data' ` event, calling the ` readable.pipe() `
598
+ streams data is provided so the stream will not generate its data. While in this
599
+ state, attaching a listener for the ` 'data' ` event, calling the ` readable.pipe() `
601
600
method, or calling the ` readable.resume() ` method will switch
602
601
` readable._readableState.flowing ` to ` true ` , causing the Readable to begin
603
602
actively emitting events as data is generated.
604
603
605
604
Calling ` readable.pause() ` , ` readable.unpipe() ` , or receiving "back pressure"
606
605
will cause the ` readable._readableState.flowing ` to be set as ` false ` ,
607
606
temporarily halting the flowing of events but * not* halting the generation of
608
- data.
607
+ data. While in this state, attaching a listener for the ` 'data' ` event
608
+ would not cause ` readable._readableState.flowing ` to switch to ` true ` .
609
+
610
+ ``` js
611
+ const { PassThrough , Writable } = require (' stream' );
612
+ const pass = new PassThrough ();
613
+ const writable = new Writable ();
614
+
615
+ pass .pipe (writable); pass .unpipe (writable); // flowing is now false
616
+ pass .on (' data' , (chunk ) => { console .log (chunk .toString ()); });
617
+ pass .write (' ok' ); // will not emit 'data'
618
+ pass .resume (); // must be called to make 'data' being emitted
619
+ ```
609
620
610
621
While ` readable._readableState.flowing ` is ` false ` , data may be accumulating
611
622
within the streams internal buffer.
0 commit comments