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

Commit

Permalink
doc: additional refinement to readable event
Browse files Browse the repository at this point in the history
Per #25635 (comment)

Additional refinement to the clarification on the `readable` event

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #25591
  • Loading branch information
jasnell committed Aug 4, 2015
1 parent 881d9be commit eda2560
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions doc/api/stream.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eda2560

Please sign in to comment.