-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
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]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,10 +440,12 @@ occurs, the `callback` *may or may not* be called with the error as its | |
first argument. To reliably detect write errors, add a listener for the | ||
`'error'` event. | ||
|
||
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. | ||
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 | ||
stop until the [`'drain'`][] event is emitted. However, the `false` return | ||
value is only advisory and the writable stream will unconditionally accept and | ||
buffer `chunk` even if it has not not been allowed to drain. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
binki
Contributor
|
||
|
||
A Writable stream in object mode will always ignore the `encoding` argument. | ||
|
||
|
2 comments
on commit f347dad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal buffer does not exceed
should be internal buffer is less than
. See #9247
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@binki care to file a pull request for that?
Defining it advisory is not a good choice of word. IMHO advisory is a positive term, as "you can avoid doing this, it has no issues". However, if you keep writing when it return false, you are essentially creating a memory leak in the worst case, and in the nicer case you are creating unneeded pressure on the GC.