Browse Source

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
v0.12-staging
James M Snell 10 years ago
parent
commit
eda2560cdc
  1. 9
      doc/api/stream.markdown

9
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 The `readable` event is not emitted in the "flowing" mode with the
sole exception of the last one, on end-of-stream. sole exception of the last one, on end-of-stream.
Note that the `'readable'` event indicates only that data *can* be The 'readable' event indicates that the stream has new information:
read from the stream. It does not indicate whether there is actual either new data is available or the end of the stream has been reached.
data to be consumed. The callback passed to handle the `'readable'` In the former case, `.read()` will return that data. In the latter case,
event must be prepared to handle a `null` response from `.read()` will return null. For instance, in the following example, `foo.txt`
`readable.read([size])`. For instance, in the following example, `foo.txt`
is an empty file: is an empty file:
```javascript ```javascript

Loading…
Cancel
Save