fromAsyncIterable
fromAsyncIterable<
T>(iterable):ReadableStream<T>
Defined in: stream-utils.ts:350
Create a ReadableStream from an async iterable source.
This utility converts any async iterable (like async generators) into a ReadableStream, making it compatible with browser streaming APIs and React streaming hooks. Useful for bridging between Node.js-style async iterators and Web Streams API.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”AsyncIterable<T>
Any async iterable source (async generator, etc.)
Returns
Section titled “Returns”ReadableStream<T>
ReadableStream emitting values from the iterable
Example
Section titled “Example”async function* generateData() { yield 'chunk 1'; yield 'chunk 2'; yield 'chunk 3';}
const stream = fromAsyncIterable(generateData());const response = new Response(stream);