{"_id":"@cjser/sec-ant__readable-stream__v0_4_1","name":"@cjser/sec-ant__readable-stream__v0_4_1","dist-tags":{"latest":"0.4.1-cjser.2"},"versions":{"0.4.1-cjser.2":{"name":"@cjser/sec-ant__readable-stream__v0_4_1","description":"A tiny, zero-dependency yet spec-compliant asynchronous iterator polyfill/ponyfill for ReadableStreams.","private":false,"version":"0.4.1-cjser.2","type":"module","main":"./dist-cjser/index.cjs","module":"./dist/index/index.js","exports":{".":{"require":"./dist-cjser/index.cjs","default":"./dist/index/index.js"},"./asyncIterator":{"require":"./dist-cjser/asyncIterator.cjs","default":"./dist/index/asyncIterator.js"},"./fromAnyIterable":{"require":"./dist-cjser/fromAnyIterable.cjs","default":"./dist/index/fromAnyIterable.js"},"./ponyfill":{"require":"./dist-cjser/ponyfill.cjs","default":"./dist/ponyfill/index.js"},"./ponyfill/asyncIterator":{"require":"./dist-cjser/ponyfill/asyncIterator.cjs","default":"./dist/ponyfill/asyncIterator.js"},"./ponyfill/fromAnyIterable":{"require":"./dist-cjser/ponyfill/fromAnyIterable.cjs","default":"./dist/ponyfill/fromAnyIterable.js"},"./polyfill":{"require":"./dist-cjser/polyfill.cjs","default":"./dist/polyfill/index.js"},"./polyfill/asyncIterator":{"require":"./dist-cjser/polyfill/asyncIterator.cjs","default":"./dist/polyfill/asyncIterator.js"},"./polyfill/fromAnyIterable":{"require":"./dist-cjser/polyfill/fromAnyIterable.cjs","default":"./dist/polyfill/fromAnyIterable.js"},"./async-iterator":{"types":"./dist/types/async-iterator.d.ts"}},"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues","email":"zezhengwu@proton.me"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm","from-iterable"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","publishConfig":{"access":"public"},"scripts":{"install:ci":"npm ci && npx playwright install --with-deps","install:codesandbox":"npm ci && ./scripts/prepare.sh","update-hooks":"simple-git-hooks","changeset":"changeset","bump":"changeset version 2>/dev/null | grep . && npm i; exit 0","type-check":"tsc --noEmit --emitDeclarationOnly false","format:prettier":"prettier . --write","format:biome":"biome format . --write","format":"conc \"npm:format:prettier\" \"npm:format:biome\"","check:biome":"biome check --apply .","check":"conc \"npm:format:prettier\" \"npm:check:biome\"","prebuild":"npm run check && npm run type-check","build":"vite build","copy":"copy-files-from-to","postbuild":"tsc && npm run copy","test:chromium":"vitest run --browser.name=chromium","test:firefox":"vitest run --browser.name=firefox","test":"npm run test:chromium && npm run test:firefox","test:coverage":"vitest run --coverage","test:ui":"vitest --ui --coverage","bump-biome:latest":"npm i -DE @biomejs/biome@latest","bump-biome:nightly":"npm i -DE @biomejs/biome@nightly"},"devDependencies":{"@biomejs/biome":"1.6.1","@changesets/cli":"^2.27.1","@commitlint/cli":"^19.1.0","@commitlint/config-conventional":"^19.1.0","@vitest/browser":"^1.3.1","@vitest/coverage-istanbul":"^1.3.1","@vitest/ui":"^1.3.1","concurrently":"^8.2.2","copy-files-from-to":"^3.9.1","lint-staged":"^15.2.2","playwright":"^1.42.1","prettier":"^3.2.5","simple-git-hooks":"^2.10.0","typescript":"^5.4.2","vite":"^5.1.6","vitest":"^1.3.1"},"cjser":{"sourceVersion":"0.4.1","cjserVersion":2,"original":{"name":"@sec-ant/readable-stream","version":"0.4.1","main":"./dist/index/index.js","exports":{".":"./dist/index/index.js","./asyncIterator":"./dist/index/asyncIterator.js","./fromAnyIterable":"./dist/index/fromAnyIterable.js","./ponyfill":"./dist/ponyfill/index.js","./ponyfill/asyncIterator":"./dist/ponyfill/asyncIterator.js","./ponyfill/fromAnyIterable":"./dist/ponyfill/fromAnyIterable.js","./polyfill":"./dist/polyfill/index.js","./polyfill/asyncIterator":"./dist/polyfill/asyncIterator.js","./polyfill/fromAnyIterable":"./dist/polyfill/fromAnyIterable.js","./async-iterator":{"types":"./dist/types/async-iterator.d.ts"}},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"files":["./dist"],"scripts":{"install:ci":"npm ci && npx playwright install --with-deps","install:codesandbox":"npm ci && ./scripts/prepare.sh","update-hooks":"simple-git-hooks","changeset":"changeset","bump":"changeset version 2>/dev/null | grep . && npm i; exit 0","type-check":"tsc --noEmit --emitDeclarationOnly false","format:prettier":"prettier . --write","format:biome":"biome format . --write","format":"conc \"npm:format:prettier\" \"npm:format:biome\"","check:biome":"biome check --apply .","check":"conc \"npm:format:prettier\" \"npm:check:biome\"","prebuild":"npm run check && npm run type-check","build":"vite build","copy":"copy-files-from-to","postbuild":"tsc && npm run copy","test:chromium":"vitest run --browser.name=chromium","test:firefox":"vitest run --browser.name=firefox","test":"npm run test:chromium && npm run test:firefox","test:coverage":"vitest run --coverage","test:ui":"vitest --ui --coverage","prepublishOnly":"npm run build","bump-biome:latest":"npm i -DE @biomejs/biome@latest","bump-biome:nightly":"npm i -DE @biomejs/biome@nightly"}}},"_id":"@cjser/sec-ant__readable-stream__v0_4_1@0.4.1-cjser.2","gitHead":"0168e4aac54a1a9ca6f921419fa5ed9edb53ef4a","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-mB+9szQvl3pFp/owtFX3pj0incDcpwDUPl86jKuVL+QecABDOyHixJj0C8qe1d/QrTkmFgC3/wdGtzY87Drs5w==","shasum":"b255a67d79084253b6e83884456c36a4781c3ce1","tarball":"https://registry.npmjs.org/@cjser/sec-ant__readable-stream__v0_4_1/-/sec-ant__readable-stream__v0_4_1-0.4.1-cjser.2.tgz","fileCount":34,"unpackedSize":43049,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBEfX0d6H51Y0Oee/2DyOFWp8Tl6M84/yAWxy5+ZA3evAiEA/uyQvA2wSkqfKtowsL1migF0rc7QVOMknxZ28tkHwo0="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sec-ant__readable-stream__v0_4_1_0.4.1-cjser.2_1778130971216_0.4119399063223512"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T05:16:11.092Z","0.4.1-cjser.2":"2026-05-07T05:16:11.364Z","modified":"2026-05-07T05:16:11.537Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"A tiny, zero-dependency yet spec-compliant asynchronous iterator polyfill/ponyfill for ReadableStreams.","homepage":"https://github.com/Sec-ant/readable-stream","keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm","from-iterable"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Ze-Zheng Wu"},"bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues","email":"zezhengwu@proton.me"},"license":"MIT","readme":"# @sec-ant/readable-stream\n\n[![npm version](https://img.shields.io/npm/v/@sec-ant/readable-stream?cacheSeconds=300)](https://www.npmjs.com/package/@sec-ant/readable-stream/v/latest) [![npm downloads](https://img.shields.io/npm/dm/@sec-ant/readable-stream?cacheSeconds=300)](https://www.npmjs.com/package/@sec-ant/readable-stream/v/latest) [![](https://img.shields.io/jsdelivr/npm/hm/@sec-ant/readable-stream?cacheSeconds=300&color=ff5627)](https://www.jsdelivr.com/package/npm/@sec-ant/readable-stream) [![bundlephobia minzipped](https://img.shields.io/bundlephobia/minzip/@sec-ant/readable-stream?cacheSeconds=300)](https://bundlephobia.com/package/@sec-ant/readable-stream@latest) [![npm license](https://img.shields.io/npm/l/@sec-ant/readable-stream?cacheSeconds=300)](https://www.npmjs.com/package/@sec-ant/readable-stream/v/latest)\n\nA tiny, zero-dependency yet spec-compliant asynchronous iterator polyfill/ponyfill for [`ReadableStream`](https://developer.mozilla.org/docs/Web/API/ReadableStream)s.\n\n## Features\n\n### Asynchronously iterate a `ReadableStream`\n\nWith this package, you can consume a `ReadableStream` as an `AsyncIterable`.\n\n- spec: https://streams.spec.whatwg.org/#rs-asynciterator\n- tests: https://github.com/Sec-ant/readable-stream/blob/main/tests/asyncIterator.spec.ts (copied from [wpt](https://github.com/web-platform-tests/wpt/blob/309231a7f3e900d04914bc4963b016efd9989a00/streams/readable-streams/async-iterator.any.js))\n\n### Convert an `AsyncIterable` or an `Iterable` into a `ReadableStream`\n\nWith this package, you can construct a `ReadableStream` from an `AsyncIterable` or an `Iterable`.\n\n- spec: https://streams.spec.whatwg.org/#rs-from\n- tests: https://github.com/Sec-ant/readable-stream/blob/main/tests/fromAnyIterable.spec.ts (copied from [wpt](https://github.com/web-platform-tests/wpt/blob/309231a7f3e900d04914bc4963b016efd9989a00/streams/readable-streams/from.any.js))\n\nThis package passes all the aforementioned tests.\n\n## Install\n\n```bash\nnpm i @sec-ant/readable-stream\n```\n\n## Usage\n\n### Ponyfill\n\nThis package can be imported as a _ponyfill_ to avoid side effects:\n\n#### `asyncIterator`\n\nPath:\n\n```\n@sec-ant/readable-stream/ponyfill/asyncIterator\n```\n\nExample:\n\n```ts\nimport {\n  asyncIterator,\n  type ReadableStreamIteratorOptions,\n} from \"@sec-ant/readable-stream/ponyfill/asyncIterator\";\n\nconst readableStream = (await fetch(\"https://www.example.org/\")).body;\n\nlet total = 0;\nfor await (const chunk of asyncIterator.call(readableStream)) {\n  total += chunk.length;\n}\n\nconsole.log(total);\n```\n\nCheck https://streams.spec.whatwg.org/#rs-class-definition and https://streams.spec.whatwg.org/#rs-asynciterator for further explanation on `ReadableStreamIteratorOptions`.\n\n#### `fromAnyIterable`\n\nPath:\n\n```\n@sec-ant/readable-stream/ponyfill/fromAnyIterable\n```\n\nExample:\n\n```ts\nimport { fromAnyIterable } from \"@sec-ant/readable-stream/ponyfill/fromAnyIterable\";\n\nconst readableStream = fromAnyIterable([\"a\", \"b\"]);\n```\n\n#### All-in-One\n\nPath:\n\n```\n@sec-ant/readable-stream/ponyfill\n```\n\nExample:\n\n```ts\nimport {\n  fromAnyIterable,\n  asyncIterator,\n  type ReadableStreamIteratorOptions,\n} from \"@sec-ant/readable-stream/ponyfill\";\n```\n\n### Polyfill\n\nThis package can be imported as a drop-in _polyfill_ with side effects.\n\n#### `ReadableStream.prototype[Symbol.asyncIterator]` and `ReadableStream.prototype.values`\n\nPath:\n\n```\n@sec-ant/readable-stream/polyfill/asyncIterator\n```\n\nExample:\n\n```ts\nimport \"@sec-ant/readable-stream/polyfill/asyncIterator\";\n\nconst readableStream = (await fetch(\"https://www.example.org/\")).body;\n\nlet total = 0;\nfor await (const chunk of readableStream) {\n  total += chunk.length;\n}\n\nconsole.log(total);\n```\n\n#### `ReadableStream.from`\n\nPath:\n\n```\n@sec-ant/readable-stream/polyfill/fromAnyIterable\n```\n\nExample:\n\n```js\nimport \"@sec-ant/readable-stream/polyfill/fromAnyIterable\";\n\nconst readableStream = ReadableStream.from([\"a\", \"b\"]);\n```\n\nNote that `ReadableStream.from` is not typed because [declared vars cannot be overridden](https://github.com/microsoft/TypeScript/issues/36146).\n\n#### All-in-One\n\nPath:\n\n```\n@sec-ant/readable-stream/polyfill\n```\n\nExample:\n\n```ts\nimport \"@sec-ant/readable-stream/polyfill\";\n```\n\n### Ponyfill + Polyfill\n\n#### `asyncIterator`\n\nPath:\n\n```\n@sec-ant/readable-stream/asyncIterator\n```\n\nExample:\n\n```ts\nimport {\n  asyncIterator,\n  type ReadableStreamIteratorOptions,\n} from \"@sec-ant/readable-stream/asyncIterator\";\n// also with side effects\n```\n\n#### `fromAnyIterable`\n\nPath:\n\n```\n@sec-ant/readable-stream/fromAnyIterable\n```\n\nExample:\n\n```ts\nimport { fromAnyIterable } from \"@sec-ant/readable-stream/fromAnyIterable\";\n// also with side effects\n```\n\n#### All-in-One\n\nPath:\n\n```\n@sec-ant/readable-stream\n```\n\nExample:\n\n```ts\nimport {\n  fromAnyIterable,\n  asyncIterator,\n  type ReadableStreamIteratorOptions,\n} from \"@sec-ant/readable-stream\";\n// also with side effects\n```\n\n### Types\n\nYou can also use this package to augment the `ReadableStream` type for async iteration if the runtime already supports it but the type system does not.\n\nPath:\n\n```\n@sec-ant/readable-stream/async-iterator\n```\n\nExample:\n\n```ts\n/// <reference types=\"@sec-ant/readable-stream/async-iterator\" />\n```\n\n## License\n\nMIT\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/Sec-ant/readable-stream\n","readmeFilename":"README.md","_rev":"1-d7eebc64b5b7b84c1ef6803b7a182628"}