diff options
author | James M Snell <jasnell@gmail.com> | 2015-06-26 07:51:14 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2015-08-03 20:44:39 -0700 |
commit | 618e4ecda99f13c781945df6c3b8433dca3bad87 (patch) | |
tree | f57c84f819c3e57b5951b180e1a26b33fd561798 | |
parent | 0b165be37ba66de728b300b980dcf3d4243e5dc0 (diff) | |
download | node-618e4ecda99f13c781945df6c3b8433dca3bad87.tar.gz |
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
-rw-r--r-- | doc/api/stream.markdown | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown index 52326304d..3c879eac1 100644 --- a/doc/api/stream.markdown +++ b/doc/api/stream.markdown @@ -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' |