readableStreamFromAsyncIterable
readableStreamFromAsyncIterable<
T>(iterable,signal?):Promise<ReadableStream<T>>
Defined in: packages/synapse-core/src/utils/streams.ts:39
Wrap an AsyncIterable in a ReadableStream. The first chunk is read before returning, so the
source’s own errors reject here; cancelling the stream calls the iterator’s return.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
iterable |
AsyncIterable<T> |
The source to read |
signal? |
AbortSignal |
Aborts the wait for the first chunk |
Returns
Section titled “Returns”A stream of the iterable’s chunks