Skip to content

Commit dc6dadd

Browse files
陈刚MylesBorins
authored andcommitted
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: #22380 PR-URL: #18283 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 711098e commit dc6dadd

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
@@ -1740,6 +1740,10 @@ class SourceWrapper extends Readable {
17401740
*Note*: The `readable.push()` method is intended be called only by Readable
17411741
Implementers, and only from within the `readable._read()` method.
17421742

1743+
For streams not operating in object mode, if the `chunk` parameter of
1744+
`readable.push()` is `undefined`, it will be treated as empty string or
1745+
buffer. See [`readable.push('')`][] for more information.
1746+
17431747
#### Errors While Reading
17441748

17451749
It is recommended that errors occurring during the processing of the
@@ -2259,6 +2263,7 @@ contain multi-byte characters.
22592263
[`stream.uncork()`]: #stream_writable_uncork
22602264
[`stream.unpipe()`]: #stream_readable_unpipe_destination
22612265
[`stream.wrap()`]: #stream_readable_wrap_stream
2266+
[`readable.push('')`]: #stream_readable_push
22622267
[`writable.cork()`]: #stream_writable_cork
22632268
[`writable.uncork()`]: #stream_writable_uncork
22642269
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options

0 commit comments

Comments
 (0)