File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1557,6 +1557,12 @@ closed until the Node.js process exits, regardless of the specified options.
15571557
15581558<!-- YAML
15591559added: v0.9.4
1560+ changes:
1561+ - version: v26.0.0
1562+ pr-url: https://github.com/nodejs/node/pull/60441
1563+ description: When called without a `size` argument, `readable.read()` now
1564+ returns one buffered chunk per call instead of draining the
1565+ entire internal buffer.
15601566-->
15611567
15621568* ` size ` {number} Optional argument to specify how much data to read.
@@ -1573,8 +1579,12 @@ The optional `size` argument specifies a specific number of bytes to read. If
15731579the stream has ended, in which case all of the data remaining in the internal
15741580buffer will be returned.
15751581
1576- If the ` size ` argument is not specified, all of the data contained in the
1577- internal buffer will be returned.
1582+ If the ` size ` argument is not specified, ` readable.read() ` returns the next
1583+ buffered chunk, or the next object in object mode. If the entire internal
1584+ buffer is needed in a single call, ` readable.read(readable.readableLength) `
1585+ returns all currently buffered data; because data can be buffered internally
1586+ without an explicit ` push() ` , some cases may additionally require calling
1587+ ` readable.read(0) ` first to ensure all buffered data is available.
15781588
15791589The ` size ` argument must be less than or equal to 1 GiB.
15801590
You can’t perform that action at this time.
0 commit comments