Skip to content

Commit 6f177e7

Browse files
陈刚addaleax
陈刚
authored andcommitted
doc: readable.push(undefined) in non-object mode
`readable.push()` supports `undefined` in non-object mode, but it was not previously documented. PR-URL: #18283 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 2282dce commit 6f177e7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/api/stream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,10 @@ class SourceWrapper extends Readable {
17491749
*Note*: The `readable.push()` method is intended be called only by Readable
17501750
Implementers, and only from within the `readable._read()` method.
17511751

1752+
For streams not operating in object mode, if the `chunk` parameter of
1753+
`readable.push()` is `undefined`, it will be treated as empty string or
1754+
buffer. See [`readable.push('')`][] for more information.
1755+
17521756
#### Errors While Reading
17531757

17541758
It is recommended that errors occurring during the processing of the
@@ -2264,6 +2268,7 @@ contain multi-byte characters.
22642268
[`stream.uncork()`]: #stream_writable_uncork
22652269
[`stream.unpipe()`]: #stream_readable_unpipe_destination
22662270
[`stream.wrap()`]: #stream_readable_wrap_stream
2271+
[`readable.push('')`]: #stream_readable_push
22672272
[`writable.cork()`]: #stream_writable_cork
22682273
[`writable.uncork()`]: #stream_writable_uncork
22692274
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options

0 commit comments

Comments
 (0)