Skip to content

streams documentation for writable.write(chunk) describes return value incorrectly #9247

Closed
@binki

Description

@binki

The return value indicates whether the written chunk was buffered internally and the buffer has exceeded the highWaterMark configured when the stream was created. If false is returned, further attempts to write data to the stream should be paused until the 'drain' event is emitted.

This suggests that when writable.write(chunk) returns false, the passed chunk was not buffered. In reality, write() always unconditionally buffers the chunk regardless of what it returns. Its return value is only advisory.

I would suggest language like this

The return value is true if the internal buffer does not exceed highWaterMark configured when the stream was created after admitting chunk. If false is returned, further attempts to write data to the stream should be paused until the 'drain' event is emitted. However, the false return value is only advisory and the writable stream will unconditionally accept chunk even if it has not not been allowed to drain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions