This package can be imported as a ponyfill to avoid side effects:
asyncIterator
Path:
@sec-ant/readable-stream/ponyfill/asyncIterator
Example:
import { asyncIterator, type ReadableStreamIteratorOptions,} from "@sec-ant/readable-stream/ponyfill/asyncIterator";const readableStream = (await fetch("https://www.example.org/")).body;let total = 0;for await (const chunk of asyncIterator(readableStream)) { total += chunk.length;}console.log(total);
Browser tests run in Chromium, Firefox, and WebKit. WPT runs the upstream async
iteration, iterable conversion, cross-realm, and Streams IDL suites in Window and
Dedicated Worker environments. The IDL suite compares polyfill results with the
browser's native baseline. The upstream revision is pinned in
compatibility/prepare.mjs and configurable through WPT_REVISION.
The verified runtime matrix includes Chromium 156, Firefox 157, WebKit 27.2,
Safari 27.2, Chrome 114, Firefox 115, and WebKit 17. These tests use native
ReadableStream support and the package's ESNext build. WebKit entries refer to
Playwright engine builds.
For Safari, enable remote automation and run safaridriver -p 4444 in a separate
terminal. The legacy installer provides isolated macOS browser downloads.
Benchmarks compare the current implementation with the revision pinned in
benchmarks/prepare.mjs. Each workload has six warmup rounds and 25 measured
rounds with rotating implementation order. Node, Chromium, and Firefox run
sequentially. Individual runtimes can be selected with pnpm benchmark node or
pnpm benchmark chromium firefox.
Allocation sampling measures allocated bytes across the Node workload. The
retention check verifies collection of consumed buffers while iterators remain
alive. Reports, upstream sources, and browser downloads are generated under
.vitest/.