Skip to content

Commit

Permalink
doc: add a note about readable in flowing mode
Browse files Browse the repository at this point in the history
Original: nodejs/node-v0.x-archive#8682

Slightly modified version of the original PR (nodejs#8682) to add
appropriate line wrapping and fix a couple of grammar nits.

Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs/node-v0.x-archive#25591
  • Loading branch information
jasnell committed Aug 4, 2015
1 parent e603452 commit 66047a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/api/stream.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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'

Expand Down

0 comments on commit 66047a5

Please sign in to comment.