Skip to content

Commit 618e4ec

Browse files
committed
doc: add a note about readable in flowing mode
Original: nodejs/node-v0.x-archive#8682 Slightly modified version of the original PR (#8682) to add appropriate line wrapping and fix a couple of grammar nits. Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: nodejs/node-v0.x-archive#25591
1 parent 0b165be commit 618e4ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/stream.markdown

+6
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ readable.on('readable', function() {
164164
Once the internal buffer is drained, a `readable` event will fire
165165
again when more data is available.
166166

167+
The `readable` event is not emitted in the "flowing" mode with the
168+
sole exception of the last one, on end-of-stream.
169+
167170
#### Event: 'data'
168171

169172
* `chunk` {Buffer | String} The chunk of data.
@@ -181,6 +184,9 @@ readable.on('data', function(chunk) {
181184
console.log('got %d bytes of data', chunk.length);
182185
});
183186
```
187+
Note that the `readable` event should not be used together with `data`
188+
because the assigning the latter switches the stream into "flowing" mode,
189+
so the `readable` event will not be emitted.
184190

185191
#### Event: 'end'
186192

0 commit comments

Comments
 (0)