Skip to content

doc: update readable.read() for v26 one-chunk behaviour - #67341

Open
Fuma2514 wants to merge 1 commit into
nodejs:mainfrom
Fuma2514:doc-stream-read-v26
Open

Fuma2514 wants to merge 1 commit into
nodejs:mainfrom
Fuma2514:doc-stream-read-v26

Conversation

@Fuma2514

@Fuma2514 Fuma2514 commented Nov 8, 2026

Copy link
Copy Markdown

Fixes #67323.

Since #60441 (v26.0.0, semver-major), readable.read() without a size argument returns one buffered chunk per call, but doc/api/stream.md still said it returns "all of the data contained in the internal buffer". This PR:

Docs only, no code changes. Verified that no other part of the example text depends on the old wording; the while (null !== (chunk = readable.read())) loop example remains correct under the new behaviour (it now drains one chunk per iteration until null).

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. stream Issues and PRs related to Node.js streams. labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

@MikeMcC399

This comment was marked as resolved.

Signed-off-by: Fuma2514 <fuma2514@users.noreply.github.com>
@Fuma2514
Fuma2514 force-pushed the doc-stream-read-v26 branch from 6edfe47 to 9cbb860 Compare November 8, 2026 14:42
@MikeMcC399

Copy link
Copy Markdown
Contributor

According to #60441 (comment) from @mcollina


actually, no doc changes are needed.

and quoting from https://nodejs.org/docs/latest/api/stream.html#readablereadsize

Each call to readable.read() returns a chunk of data or null, signifying that there's no more data to read at that moment. These chunks aren't automatically concatenated. Because a single read() call does not return all the data, using a while loop may be necessary to continuously read chunks until all data is retrieved. When reading a large file, .read() might return null temporarily, indicating that it has consumed all buffered content but there may be more data yet to be buffered. In such cases, a new 'readable' event is emitted once there's more data in the buffer, and the 'end' event signifies the end of data transmission.


due to PR #60441 which landed in Node.js 26.0.0

This PR should be reviewed by the original author of #60441 @ronag & @mcollina

@MikeMcC399
MikeMcC399 requested review from mcollina and ronag November 8, 2026 21:11
@MikeMcC399 MikeMcC399 added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. labels Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:automated-account author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. doc Issues and PRs related to Node.js documentation. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. stream Issues and PRs related to Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: readable.read() still documents pre-v26 behaviour (returns all buffered data when size is omitted)

4 participants