Skip to content

Commit ba6a1b6

Browse files
Tanuja-SawantMylesBorins
Tanuja-Sawant
authored andcommitted
doc: update writable.write return value
stream.md is updated to explain the return value of writable.write(chunk) precisely. PR-URL: #9468 Fixes: #9247 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ron Korving <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 014fe03 commit ba6a1b6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/api/stream.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,12 @@ occurs, the `callback` *may or may not* be called with the error as its
440440
first argument. To reliably detect write errors, add a listener for the
441441
`'error'` event.
442442

443-
The return value indicates whether the written `chunk` was buffered internally
444-
and the buffer has exceeded the `highWaterMark` configured when the stream was
445-
created. If `false` is returned, further attempts to write data to the stream
446-
should be paused until the [`'drain'`][] event is emitted.
443+
The return value is `true` if the internal buffer does not exceed
444+
`highWaterMark` configured when the stream was created after admitting `chunk`.
445+
If `false` is returned, further attempts to write data to the stream should
446+
stop until the [`'drain'`][] event is emitted. However, the `false` return
447+
value is only advisory and the writable stream will unconditionally accept and
448+
buffer `chunk` even if it has not not been allowed to drain.
447449

448450
A Writable stream in object mode will always ignore the `encoding` argument.
449451

0 commit comments

Comments
 (0)