Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Guides · Streams

Convert a ReadableStream to an array of chunks

Collect every chunk of a ReadableStream into an array with Bun.readableStreamToArray().

Bun.readableStreamToArray reads the contents of a ReadableStream into an array of chunks.

const stream = new ReadableStream();
const chunks = await Bun.readableStreamToArray(stream);

See Bun's other ReadableStream conversion functions.