# readableStreamFromAsyncIterable

> **readableStreamFromAsyncIterable**\<`T`\>(`iterable`, `signal?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ReadableStream`](https://developer.mozilla.org/docs/Web/API/ReadableStream)\<`T`\>\>

Defined in: [packages/synapse-core/src/utils/streams.ts:39](https://github.com/FilOzone/synapse-sdk/blob/5989c4b03ed2fe4cf8b1ef29efe1d4ff1ad4c7bc/packages/synapse-core/src/utils/streams.ts#L39)

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

| Type Parameter |
| ------ |
| <a id="type-parameter-t"></a> `T` |

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `iterable` | `AsyncIterable`\<`T`\> | The source to read |
| `signal?` | [`AbortSignal`](https://developer.mozilla.org/docs/Web/API/AbortSignal) | Aborts the wait for the first chunk |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ReadableStream`](https://developer.mozilla.org/docs/Web/API/ReadableStream)\<`T`\>\>

A stream of the iterable's chunks