UNPKG

sflow

Version:

sflow is a powerful and highly-extensible library designed for processing and manipulating streams of data effortlessly. Inspired by the functional programming paradigm, it provides a rich set of utilities for transforming streams, including chunking, fil

13 lines (12 loc) 278 B
export async function* streamAsyncIterator<T>(this: ReadableStream<T>) { const reader = this.getReader(); try { while (1) { const { done, value } = await reader.read(); if (done) return; yield value; } } finally { reader.releaseLock(); } }