From 9cbb8605155fa54455e0674bd37e48a0608f99db Mon Sep 17 00:00:00 2001 From: Fuma2514 Date: Sun, 8 Nov 2026 17:46:33 +0800 Subject: [PATCH] doc: update readable.read() for v26 one-chunk behaviour Signed-off-by: Fuma2514 --- doc/api/stream.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 1e8a2bd1ef93..a676b98923df 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1557,6 +1557,12 @@ closed until the Node.js process exits, regardless of the specified options. * `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 the stream has ended, in which case all of the data remaining in the internal buffer will be returned. -If the `size` argument is not specified, all of the data contained in the -internal buffer will be returned. +If the `size` argument is not specified, `readable.read()` returns the next +buffered chunk, or the next object in object mode. If the entire internal +buffer is needed in a single call, `readable.read(readable.readableLength)` +returns all currently buffered data; because data can be buffered internally +without an explicit `push()`, some cases may additionally require calling +`readable.read(0)` first to ensure all buffered data is available. The `size` argument must be less than or equal to 1 GiB.