@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
24 lines • 614 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toIterable = void 0;
const toIterator_1 = require("@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)) {
*
* }
* ```
*/
function toIterable(stream, options) {
return {
[Symbol.asyncIterator]: () => (0, toIterator_1.toIterator)(stream, options),
};
}
exports.toIterable = toIterable;
//# sourceMappingURL=toIterable.js.map