Skip to content

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

Closed

Description

@v-dev-cl

Affected URL(s)

https://nodejs.org/api/stream.html#readablereadsize

Description of the problem

Since v26.0.0, readable.read() called with no size returns one buffered chunk per call. This came from #60441 (semver-major, "stream: readable read one buffer at a time"). The API docs still describe the old behaviour:

If the size argument is not specified, all of the data contained in the internal buffer will be returned.

The YAML history of readable.read([size]) also has no changes: entry for v26.0.0.

Reproduction. A non-object-mode Readable with three pushes:

import { Readable } from 'node:stream';
const r = new Readable({ read() {} });
r.push(Buffer.from('aaa')); r.push(Buffer.from('bbb')); r.push(Buffer.from('ccc'));
const first = r.read();
console.log(process.version, JSON.stringify(first.toString()), 'left:', r.readableLength);
v24.22.2 "aaabbbccc" left: 0
v26.13.0 "aaa" left: 6

Suggested doc changes:

The v26.0.0 changelog lists this change only under "Semver-Major Commits", not under "Notable Changes", so it is easy to miss when upgrading. Code that loops on read() and does work per call changes its output shape. For example, Next.js 16.4's inline Flight writer emits one <script> per read() call, so on Node 26 a large App Router page carries about 20× more inline scripts and gets slower at the tail.

Activity

  1. v-dev-cl commented on Nov 7, 2026

    @v-dev-cl
    Author

    Downstream report with a minimal reproduction: vercel/next.js#101343 (Next.js 16.4's inline Flight writer loops on read(); on Node 26 a page goes from 3 to 407 inline scripts). Repro: https://github.com/v-dev-cl/next-node26-flight-repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions