readableStreamToArray

Bun

Symbol

readableStreamToArray

function readableStreamToArray<T>(stream: ReadableStream<T>): T[] | Promise<T[]>

Consume all data from a ReadableStream until it closes or errors.

@param stream

The stream to consume

@returns

A promise that resolves with the chunks as an array

Referenced types

class ReadableStream<R = any>

This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference