From dc6dadd585a5409cf632e04002ee1c46d992b2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=88=9A?= Date: Mon, 22 Jan 2018 00:58:35 +0800 Subject: [PATCH] doc: `readable.push(undefined)` in non-object mode `readable.push()` supports `undefined` in non-object mode, but it was not previously documented. Backport-PR-URL: https://github.com/nodejs/node/pull/22380 PR-URL: https://github.com/nodejs/node/pull/18283 Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- doc/api/stream.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index f0d393543d6..b312e0f483f 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1740,6 +1740,10 @@ class SourceWrapper extends Readable { *Note*: The `readable.push()` method is intended be called only by Readable Implementers, and only from within the `readable._read()` method. +For streams not operating in object mode, if the `chunk` parameter of +`readable.push()` is `undefined`, it will be treated as empty string or +buffer. See [`readable.push('')`][] for more information. + #### Errors While Reading It is recommended that errors occurring during the processing of the @@ -2259,6 +2263,7 @@ contain multi-byte characters. [`stream.uncork()`]: #stream_writable_uncork [`stream.unpipe()`]: #stream_readable_unpipe_destination [`stream.wrap()`]: #stream_readable_wrap_stream +[`readable.push('')`]: #stream_readable_push [`writable.cork()`]: #stream_writable_cork [`writable.uncork()`]: #stream_writable_uncork [`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options