-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
Hi guys,
AFAIK, readable events are emitted in three cases:
- on the very beginning of the stream reading
- at the end of the stream reading - just before the
endevent - on every call to
.readfunction if only stream.length < stream.highWaterMark ()Line 573 in 6faa162
state.length <= state.highWaterMark;
However the doc says something different:
- in this section: https://nodejs.org/api/stream.html#stream_readable_read_size: "The while loop is necessary when processing data with readable.read(). Only after readable.read() returns null, 'readable' will be emitted."
- in this section: https://nodejs.org/api/stream.html#stream_event_readable: "The 'readable' event is emitted when there is data available to be read from the stream."
These two senteces from the doc are quite opposite. First sentence is not truth - we get readable events also in other cases. Second sentence is also not truth - the readable event is not emitted every time there is something in the stream to be read. When stream.length >= stream.highWaterMark then the readable event is not emitted even though there is data available to be read from the stream.
Generally speaking the documentation about readable events, their emissions and edge cases is really poor. Is it me who does not get it or is it indeed misleading?
hassaanp, himself65 and HarshithaKP
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.