{"_id":"@sec-ant/readable-stream","_rev":"3282832","name":"@sec-ant/readable-stream","description":"A tiny, zero-dependency yet spec-compliant asynchronous iterator polyfill/ponyfill for ReadableStreams.","dist-tags":{"latest":"0.4.1"},"maintainers":[{"name":"sec-ant","email":""}],"time":{"modified":"2024-05-16T05:35:34.000Z","created":"2022-11-24T11:26:20.659Z","0.4.1":"2024-03-16T03:01:29.447Z","0.4.0":"2024-03-16T02:29:21.940Z","0.3.2":"2023-07-20T03:53:53.936Z","0.3.1":"2022-12-20T03:26:10.990Z","0.3.0":"2022-12-19T18:45:35.065Z","0.2.0":"2022-12-18T13:37:46.812Z","0.1.0":"2022-11-25T10:01:13.132Z","0.0.1":"2022-11-24T11:26:20.659Z"},"users":{},"author":{"name":"Ze-Zheng Wu"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"versions":{"0.4.1":{"name":"@sec-ant/readable-stream","description":"A tiny, zero-dependency yet spec-compliant asynchronous iterator polyfill/ponyfill for ReadableStreams.","private":false,"version":"0.4.1","type":"module","main":"./dist/index/index.js","module":"./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"},"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","prepublishOnly":"npm run build","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"},"_id":"@sec-ant/readable-stream@0.4.1","gitHead":"707e8aa975c2800d9bc651cc46119ea66b018aa2","types":"./dist/index/index.d.ts","_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"shasum":"60de891bb126abfdc5410fdc6166aca065f10a0c","size":5201,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.4.1.tgz"},"_npmUser":{"name":"sec-ant","email":"zezhengwu@proton.me"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.4.1_1710558089285_0.4728237213288329"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-03-16T03:01:29.447Z","publish_time":1710558089447,"_source_registry_name":"default","_cnpm_publish_time":1710558089447},"0.4.0":{"name":"@sec-ant/readable-stream","description":"A tiny, zero-dependency yet spec-compliant asynchronous iterator polyfill/ponyfill for ReadableStreams.","private":false,"version":"0.4.0","type":"module","main":"./dist/index.js","module":"./dist/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"},"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","prepublishOnly":"npm run build","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"},"_id":"@sec-ant/readable-stream@0.4.0","gitHead":"4ea935a8d72b546d059191d3c76883a5b0359bb6","_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"shasum":"ab1b35c88ce4efd6ed93ede76aa32d0887a84b3d","size":5206,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.4.0.tgz"},"_npmUser":{"name":"sec-ant","email":"zezhengwu@proton.me"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.4.0_1710556161772_0.7381163200598311"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-03-16T02:29:21.940Z","publish_time":1710556161940,"_source_registry_name":"default","deprecated":"incorrect main entry point is fixed in v0.4.1","_cnpm_publish_time":1710556161940},"0.3.2":{"name":"@sec-ant/readable-stream","version":"0.3.2","description":"A Simple Yet Spec-Compliant Asynchronous Iteration Polyfill for ReadableStreams from Web Streams API","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"clean":"rm -fr ./dist/*.*s","lint":"eslint src","build":"npm run lint && npm run clean && tsc && vite build","test":"vitest","test:ui":"vitest --ui"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm","from-iterable"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^6.1.0","@typescript-eslint/parser":"^6.1.0","@vitest/browser":"^0.33.0","@vitest/ui":"^0.33.0","eslint":"^8.45.0","playwright":"^1.36.1","typescript":"^5.1.6","vite":"^4.4.4","vitest":"^0.33.0"},"gitHead":"f03f38cfcbadf815b32611ef2489da31039c8ff3","_id":"@sec-ant/readable-stream@0.3.2","_nodeVersion":"20.3.0","_npmVersion":"9.6.7","dist":{"shasum":"e5358b950524e945230983399f99b8a03c2e5ac5","size":2588,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.3.2.tgz"},"_npmUser":{"name":"sec-ant","email":"zzwu@zju.edu.cn"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.3.2_1689825233775_0.23337344086894807"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-07-20T03:53:53.936Z","publish_time":1689825233936,"_source_registry_name":"default","_cnpm_publish_time":1689825233936},"0.3.1":{"name":"@sec-ant/readable-stream","version":"0.3.1","description":"A Simple Yet Spec-Compliant Asynchronous Iteration Polyfill for ReadableStreams from Web Streams API","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"clean":"rm -fr ./dist/*.*s","lint":"eslint src","dev":"vite","build":"npm run lint && npm run clean && tsc && vite build","test":"vitest","test:ui":"vitest --ui"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm","from-iterable"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.46.1","@typescript-eslint/parser":"^5.46.1","@vitest/ui":"^0.26.0","eslint":"^8.30.0","typescript":"^4.9.4","vite":"^4.0.2","vitest":"^0.26.0"},"gitHead":"2c7063050590c80c29355ee3025b71a73c4b522a","_id":"@sec-ant/readable-stream@0.3.1","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"shasum":"a71f6cefcbd61b63ba5ad8c09f9ea7952c59b588","size":2499,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.3.1.tgz"},"_npmUser":{"name":"sec-ant","email":"zzwu@zju.edu.cn"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.3.1_1671506770793_0.7901619172884664"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-20T03:26:18.734Z","publish_time":1671506770990,"_cnpm_publish_time":1671506770990},"0.3.0":{"name":"@sec-ant/readable-stream","version":"0.3.0","description":"a very simple web streams API ReadableStream asynchronous iteration polyfill","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"clean":"rm -fr ./dist/*.*s","lint":"eslint src","dev":"vite","build":"npm run lint && npm run clean && tsc && vite build","test":"vitest","test:ui":"vitest --ui"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.46.1","@typescript-eslint/parser":"^5.46.1","@vitest/ui":"^0.26.0","eslint":"^8.30.0","typescript":"^4.9.4","vite":"^4.0.2","vitest":"^0.26.0"},"gitHead":"ecc0bb4f74e50d417bdae7907118f11f9f37bbcc","_id":"@sec-ant/readable-stream@0.3.0","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"shasum":"64ef1465957e0450a8de4232bb2e8db1b5613561","size":2061,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.3.0.tgz"},"_npmUser":{"name":"sec-ant","email":"zzwu@zju.edu.cn"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.3.0_1671475534881_0.7710855988217751"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-19T18:48:18.752Z","publish_time":1671475535065,"_cnpm_publish_time":1671475535065},"0.2.0":{"name":"@sec-ant/readable-stream","version":"0.2.0","description":"a very simple web streams API ReadableStream asynchronous iteration polyfill","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"clean":"rm -fr ./dist/*.*s","lint":"eslint src","dev":"vite","build":"npm run lint && npm run clean && tsc && vite build","test":"vitest","test:ui":"vitest --ui"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.46.1","@typescript-eslint/parser":"^5.46.1","@vitest/ui":"^0.25.8","eslint":"^8.30.0","typescript":"^4.9.4","vite":"^4.0.1","vitest":"^0.25.8"},"gitHead":"1678031edad5467728ba51e97d14101eb40cc6e8","_id":"@sec-ant/readable-stream@0.2.0","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"shasum":"e9546159512df9d3cc36b969fa24871c02530eab","size":2058,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.2.0.tgz"},"_npmUser":{"name":"sec-ant","email":"zzwu@zju.edu.cn"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.2.0_1671370666666_0.8276071667216371"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-18T13:37:57.144Z","publish_time":1671370666812,"_cnpm_publish_time":1671370666812},"0.1.0":{"name":"@sec-ant/readable-stream","version":"0.1.0","description":"a very simple web streams API ReadableStream asynchronous iteration polyfill","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"clean":"rm -fr ./dist/*.*s","lint":"eslint src","build":"npm run lint && npm run clean && swc ./src -d dist && tsc","serve":"http-server -c-1 dist"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","devDependencies":{"@swc/cli":"^0.1.57","@swc/core":"^1.3.19","@typescript-eslint/eslint-plugin":"^5.44.0","@typescript-eslint/parser":"^5.44.0","eslint":"^8.28.0","http-server":"^14.1.1","typescript":"^4.9.3"},"gitHead":"61b5d40205ebccbb3e9e67bed24221643113cfa7","_id":"@sec-ant/readable-stream@0.1.0","_nodeVersion":"16.17.1","_npmVersion":"8.15.0","dist":{"shasum":"25d53545b9d1e93b8350f246fa2e390884e44188","size":1488,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.1.0.tgz"},"_npmUser":{"name":"sec-ant","email":"zzwu@zju.edu.cn"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.1.0_1669370472980_0.5673920782405824"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-25T10:23:08.240Z","publish_time":1669370473132,"_cnpm_publish_time":1669370473132},"0.0.1":{"name":"@sec-ant/readable-stream","version":"0.0.1","description":"a very simple web streams API ReadableStream asynchronous iteration polyfill","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"clean":"rm -fr ./dist/*.*s","lint":"eslint src","build":"npm run lint && npm run clean && swc ./src -d dist && tsc","serve":"http-server -c-1 dist"},"repository":{"type":"git","url":"git+https://github.com/Sec-ant/readable-stream.git"},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues"},"keywords":["stream","web-streams","readablestream","async","asynchronous","iterator","iteration","async-iterator","polyfill","esm"],"author":{"name":"Ze-Zheng Wu"},"license":"MIT","devDependencies":{"@swc/cli":"^0.1.57","@swc/core":"^1.3.19","@typescript-eslint/eslint-plugin":"^5.44.0","@typescript-eslint/parser":"^5.44.0","eslint":"^8.28.0","http-server":"^14.1.1","typescript":"^4.9.3"},"gitHead":"f52dd831f7f8fb731c12f67b8665e74a1e37313e","_id":"@sec-ant/readable-stream@0.0.1","_nodeVersion":"16.17.1","_npmVersion":"8.15.0","dist":{"shasum":"e17c97d2c7d9e7b55c8e80a6a08efbe4447789f5","size":1100,"noattachment":false,"key":"/@sec-ant/readable-stream/-/@sec-ant/readable-stream-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@sec-ant/readable-stream/download/@sec-ant/readable-stream-0.0.1.tgz"},"_npmUser":{"name":"sec-ant","email":"zzwu@zju.edu.cn"},"directories":{},"maintainers":[{"name":"sec-ant","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readable-stream_0.0.1_1669289180524_0.5640337762859671"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-24T12:19:00.516Z","publish_time":1669289180659,"_cnpm_publish_time":1669289180659}},"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","_attachments":{},"homepage":"https://github.com/Sec-ant/readable-stream","bugs":{"url":"https://github.com/Sec-ant/readable-stream/issues","email":"zezhengwu@proton.me"},"license":"MIT"}