@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
25 lines • 585 B
TypeScript
/**
* Options for {@link toIterator}.
*
* @group Sinks
*/
export interface ToIteratorOptions {
signal: AbortSignal;
}
/**
* Turns a `ReadableStream` in to an `AsyncIterator`.
*
* @group Sinks
* @see {@link toIterable:function}
* @example
* ```
* const iterator = toIterator(stream)
* while (true) {
* const result = await iterator.next()
* if (result.done) break
* doSomething(result.value)
* }
* ```
*/
export declare function toIterator<T>(stream: ReadableStream<T>, options?: ToIteratorOptions): AsyncIterator<T>;
//# sourceMappingURL=toIterator.d.ts.map