doc: update writable.write return value

stream.md is updated to explain the return value of
writable.write(chunk) precisely.

PR-URL: https://github.com/nodejs/node/pull/9468
Fixes: https://github.com/nodejs/node/issues/9247
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
Tanuja-Sawant authored and Evan Lucas committed 2017-01-04 10:44:02 -06:00
1 parent 3a7b63b81b
commit 85d2a2abcf
1 file changed
+6 -4
+6 -4
View File
@@ -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.
A Writable stream in object mode will always ignore the `encoding` argument.