diff options
author | James M Snell <jasnell@gmail.com> | 2015-07-09 16:35:32 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2015-08-03 20:44:43 -0700 |
commit | eda2560cdc6838473a89fafc61366f63bdb7e5c6 (patch) | |
tree | 2ea9258e05453005f3fd5d3a91d9b1065968efbd | |
parent | 881d9bea0159b54ed41de323d03093f0dfcee7b0 (diff) | |
download | node-eda2560cdc6838473a89fafc61366f63bdb7e5c6.tar.gz |
doc: additional refinement to readable event
Per https://github.com/joyent/node/pull/25635#discussion_r33973696
Additional refinement to the clarification on the `readable` event
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/joyent/node/pull/25591
-rw-r--r-- | doc/api/stream.markdown | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown index ecb174137..cc449403b 100644 --- a/doc/api/stream.markdown +++ b/doc/api/stream.markdown @@ -167,11 +167,10 @@ 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. -Note that the `'readable'` event indicates only that data *can* be -read from the stream. It does not indicate whether there is actual -data to be consumed. The callback passed to handle the `'readable'` -event must be prepared to handle a `null` response from -`readable.read([size])`. For instance, in the following example, `foo.txt` +The 'readable' event indicates that the stream has new information: +either new data is available or the end of the stream has been reached. +In the former case, `.read()` will return that data. In the latter case, +`.read()` will return null. For instance, in the following example, `foo.txt` is an empty file: ```javascript |