GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: update readable.read() for v26 one-chunk behaviour · nodejs/node@6e90b7c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • stream.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/stream.md‎

Copy file name to clipboardExpand all lines: doc/api/stream.md
+12-2Lines changed: 12 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,12 @@ closed until the Node.js process exits, regardless of the specified options.
15571557

15581558
<!-- YAML
15591559
added: 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
15731579
the stream has ended, in which case all of the data remaining in the internal
15741580
buffer 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

15791589
The `size` argument must be less than or equal to 1 GiB.
15801590

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.