UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

20 lines 461 B
import { toIterator } from '@johngw/stream/sinks/toIterator'; /** * Turns a `ReadableStream` in to an `AsyncIterable`. * * @group Sinks * @see {@link toArray:function} * @see {@link toIterator} * @example * ``` * for await (const chunk of toIterable(stream)) { * * } * ``` */ export function toIterable(stream, options) { return { [Symbol.asyncIterator]: () => toIterator(stream, options), }; } //# sourceMappingURL=toIterable.js.map