Web Streams

ReadableStreamDefaultReader.read()

Waits for the next chunk or end marker. An empty chunk is not an end marker; use the done property. Tested on Node.js 22.16.0. Example output (one line per entry): ["false 0 true"].

Formal Syntax & Structure

nodejs syntaxnodejs
reader.read()

Return Value

Promise<object>

Chunk and completion state.

Working Example

Example Snippetnodejs
const r = new ReadableStream({ start(c) { c.enqueue(''); c.close(); } }).getReader();try {    const a = await r.read();    const b = await r.read();    console.log(a.done, a.value.length, b.done);}finally {    r.releaseLock();}
Node.js Reference