Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 17d9495

Browse filesBrowse files
EduardoRFStargos
authored andcommitted
doc: make unshift doc compliant with push doc
readable.unshift() also allows to pass null and end stream PR-URL: #28953 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 82edebf commit 17d9495
Copy full SHA for 17d9495

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎doc/api/stream.md‎

Copy file name to clipboardExpand all lines: doc/api/stream.md
+6-3Lines changed: 6 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1244,13 +1244,16 @@ changes:
12441244
description: The `chunk` argument can now be a `Uint8Array` instance.
12451245
-->
12461246

1247-
* `chunk` {Buffer|Uint8Array|string|any} Chunk of data to unshift onto the
1247+
* `chunk` {Buffer|Uint8Array|string|null|any} Chunk of data to unshift onto the
12481248
read queue. For streams not operating in object mode, `chunk` must be a
1249-
string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be
1250-
any JavaScript value other than `null`.
1249+
string, `Buffer`, `Uint8Array` or `null`. For object mode streams, `chunk`
1250+
may be any JavaScript value.
12511251
* `encoding` {string} Encoding of string chunks. Must be a valid
12521252
`Buffer` encoding, such as `'utf8'` or `'ascii'`.
12531253

1254+
Passing `chunk` as `null` signals the end of the stream (EOF), after which no
1255+
more data can be written.
1256+
12541257
The `readable.unshift()` method pushes a chunk of data back into the internal
12551258
buffer. This is useful in certain situations where a stream is being consumed by
12561259
code that needs to "un-consume" some amount of data that it has optimistically

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.