From 1d1bb51c69059fa98fadc78ab6d28503c242492a Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Thu, 6 Nov 2014 10:05:25 +0300 Subject: [PATCH] Add a note about readable in flowing mode --- doc/api/stream.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown index bdd709f7e27e..5bc9e19fc9e6 100644 --- a/doc/api/stream.markdown +++ b/doc/api/stream.markdown @@ -164,6 +164,8 @@ 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. @@ -182,6 +184,8 @@ readable.on('data', function(chunk) { }) ``` +Note that `'readable'` event should not be used together with `'data'`, because the assigning the latter switches the stream into the "flowing" mode, so the `'readable'` event will not emitted. + #### Event: 'end' This event fires when there will be no more data to read.