From 1beb1696629492ff534ec76642b5db18a4efd0ba Mon Sep 17 00:00:00 2001 From: Tanuja-Sawant Date: Fri, 4 Nov 2016 21:11:10 +0530 Subject: [PATCH] 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 Reviewed-By: Ron Korving Reviewed-By: Roman Reiss --- doc/api/stream.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 121423095edd5d..55c1bb39780d95 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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.