Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
doc: add a note about readable in flowing mode
Browse files Browse the repository at this point in the history
Original: #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 <[email protected]>
PR-URL: #25565
  • Loading branch information
jasnell committed Jun 26, 2015
1 parent 500ff56 commit b436e59
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 b436e59

Please sign in to comment.