mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
doc: add a note about readable in flowing mode
Original: https://github.com/joyent/node/pull/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: https://github.com/joyent/node/pull/25591
This commit is contained in:
1 parent
0b165be37b
commit
618e4ecda9
1 file changed
+6
@@ -164,6 +164,9 @@ readable.on('readable', function() {
|
||||
Once the internal buffer is drained, a `readable` event will fire
|
||||
again when more data is available.
|
||||
|
||||
The `readable` event is not emitted in the "flowing" mode with the
|
||||
sole exception of the last one, on end-of-stream.
|
||||
|
||||
#### Event: 'data'
|
||||
|
||||
* `chunk` {Buffer | String} The chunk of data.
|
||||
@@ -181,6 +184,9 @@ readable.on('data', function(chunk) {
|
||||
console.log('got %d bytes of data', chunk.length);
|
||||
});
|
||||
```
|
||||
Note that the `readable` event should not be used together with `data`
|
||||
because the assigning the latter switches the stream into "flowing" mode,
|
||||
so the `readable` event will not be emitted.
|
||||
|
||||
#### Event: 'end'
|
||||
|
||||
|
||||
Reference in new issue
Block a user