{"_id":"stream-to-async-iterator","_rev":"4652833","name":"stream-to-async-iterator","description":"ES async interator wrapper for node streams","dist-tags":{"beta":"1.0.0-beta.1","latest":"1.0.0"},"maintainers":[{"name":"basicdays","email":""}],"time":{"modified":"2026-04-10T20:49:42.000Z","created":"2017-02-05T23:02:30.474Z","1.0.0":"2022-03-16T21:22:25.079Z","1.0.0-beta.1":"2018-05-30T00:59:57.061Z","0.2.0":"2017-02-05T23:02:30.474Z"},"users":{},"author":{"name":"BasicDays","email":"info@basicdays.com","url":"https://www.basicdays.com"},"repository":{"type":"git","url":"git+https://github.com/basicdays/node-stream-to-async-iterator.git"},"versions":{"1.0.0":{"name":"stream-to-async-iterator","version":"1.0.0","description":"ES async interator wrapper for node streams","keywords":["node","stream","async-iterator","promise","esnext"],"homepage":"https://github.com/basicdays/node-stream-to-async-iterator#readme","bugs":{"url":"https://github.com/basicdays/node-stream-to-async-iterator/issues"},"license":"MIT","author":{"name":"BasicDays","email":"info@basicdays.com","url":"https://www.basicdays.com"},"main":"lib/stream-to-async-iterator.js","repository":{"type":"git","url":"git+https://github.com/basicdays/node-stream-to-async-iterator.git"},"engines":{"node":">=12"},"scripts":{"build":"run-p 'build:*'","build:babel":"babel src --out-dir lib --source-maps --copy-files --extensions '.ts,.tsx,.js,.mjs'","build:tsc":"tsc --emitDeclarationOnly","clean":"rimraf coverage lib .nyc_output *.tsbuildinfo","cover":"BABEL_ENV=cover nyc mocha --config ./.mocharc.cover.json","format":"run-s format:eslint format:prettier","format:eslint":"npm run test:eslint -- --fix","format:prettier":"prettier --write .","test":"run-p 'test:*'","test:eslint":"eslint . --ext '.ts,.tsx,.js,.mjs'","test:mocha":"mocha","test:prettier":"prettier --check .","test:tsc":"tsc --noEmit","watch":"run-p 'watch:*'","watch:babel":"npm run build:babel -- --watch","watch:tsc":"npm run build:tsc -- --watch --preserveWatchOutput"},"devDependencies":{"@babel/cli":"^7.17.6","@babel/core":"^7.17.7","@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@babel/register":"^7.17.7","@istanbuljs/nyc-config-babel":"^3.0.0","@types/chai":"^4.3.0","@types/chai-as-promised":"^7.1.5","@types/mocha":"^9.1.0","@types/node":"^17.0.21","@typescript-eslint/eslint-plugin":"^5.15.0","@typescript-eslint/parser":"^5.15.0","babel-plugin-istanbul":"^6.1.1","chai":"^4.3.6","chai-as-promised":"^7.1.1","eslint":"^8.11.0","eslint-config-prettier":"^8.5.0","mocha":"^9.2.2","npm-run-all":"^4.1.5","nyc":"^15.1.0","prettier":"^2.5.1","rimraf":"^3.0.2","source-map-support":"^0.5.21","typescript":"^4.6.2"},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":12}}],"@babel/preset-typescript"],"env":{"cover":{"plugins":["babel-plugin-istanbul"]}}},"browserslist":["maintained node versions"],"nyc":{"extends":"@istanbuljs/nyc-config-babel","include":["src/**/*.{ts,tsx,js,mjs}"],"exclude":["src/test/**","*.test.{ts,tsx,js,mjs}"]},"types":"./lib/stream-to-async-iterator.d.ts","gitHead":"3b1f1099809e69524199e866af8667b4ec12ab07","_id":"stream-to-async-iterator@1.0.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"shasum":"d7af183a1fc28655741a1b1810fd008d4b1cd566","size":4730,"noattachment":false,"key":"/stream-to-async-iterator/-/stream-to-async-iterator-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-to-async-iterator/download/stream-to-async-iterator-1.0.0.tgz"},"_npmUser":{"name":"basicdays","email":"info@basicdays.com"},"directories":{},"maintainers":[{"name":"basicdays","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-to-async-iterator_1.0.0_1647465744925_0.7886680078936243"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-16T21:22:28.392Z","publish_time":1647465745079,"_cnpm_publish_time":1647465745079},"1.0.0-beta.1":{"name":"stream-to-async-iterator","version":"1.0.0-beta.1","description":"ES async interator wrapper for node streams","main":"stream-to-async-iterator.js","scripts":{"build":"make -j4 build","test":"make full-test"},"repository":{"type":"git","url":"git+https://github.com/basicdays/node-stream-to-async-iterator.git"},"keywords":["node","stream","async-iterator","promise","esnext"],"author":{"name":"BasicDays","email":"info@basicdays.com","url":"https://www.basicdays.com"},"license":"MIT","bugs":{"url":"https://github.com/basicdays/node-stream-to-async-iterator/issues"},"dependencies":{"@babel/runtime":"^7.0.0-beta.49"},"devDependencies":{"@babel/cli":"^7.0.0-beta.49","@babel/core":"^7.0.0-beta.49","@babel/plugin-transform-runtime":"^7.0.0-beta.49","@babel/preset-env":"^7.0.0-beta.49","@babel/preset-flow":"^7.0.0-beta.49","@babel/preset-stage-3":"^7.0.0-beta.49","@babel/register":"^7.0.0-beta.49","babel-eslint":"^8.2.3","babel-plugin-istanbul":"^4.1.6","chai":"^4.1.2","eslint":"^4.19.1","flow-bin":"^0.73.0","mocha":"^5.2.0","nyc":"^11.8.0","source-map-support":"^0.5.6"},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":6}}],"@babel/preset-stage-3","@babel/preset-flow"],"plugins":[["@babel/plugin-transform-runtime"]],"env":{"cover":{"plugins":["istanbul"]}}},"nyc":{"require":["@babel/register"],"sourceMap":false,"instrument":false},"readmeFilename":"README.md","homepage":"https://github.com/basicdays/node-stream-to-async-iterator#readme","_id":"stream-to-async-iterator@1.0.0-beta.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"basicdays","email":"info@basicdays.com"},"dist":{"shasum":"30d2664475e3fa0be372cfa4fec4cd65e41eda01","size":6626,"noattachment":false,"key":"/stream-to-async-iterator/-/stream-to-async-iterator-1.0.0-beta.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-to-async-iterator/download/stream-to-async-iterator-1.0.0-beta.1.tgz"},"maintainers":[{"name":"basicdays","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-to-async-iterator_1.0.0-beta.1_1527641996966_0.6727671781296607"},"_hasShrinkwrap":false,"publish_time":1527641997061,"_cnpm_publish_time":1527641997061,"_cnpmcore_publish_time":"2021-12-17T02:57:19.118Z"},"0.2.0":{"name":"stream-to-async-iterator","version":"0.2.0","description":"ES async interator wrapper for node streams","main":"stream-to-async-iterator.js","scripts":{"build":"make -j4 build","test":"make full-test"},"repository":{"type":"git","url":"git+https://github.com/basicdays/node-stream-to-async-iterator.git"},"keywords":["node","stream","async-iterator","promise","esnext"],"author":{"name":"BasicDays","email":"info@basicdays.com","url":"https://www.basicdays.com"},"license":"MIT","bugs":{"url":"https://github.com/basicdays/node-stream-to-async-iterator/issues"},"devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-plugin-istanbul":"^3.0.0","babel-plugin-transform-async-generator-functions":"^6.17.0","babel-plugin-transform-flow-strip-types":"^6.18.0","babel-polyfill":"^6.20.0","babel-preset-env":"^1.1.1","babel-register":"^6.18.0","chai":"^3.5.0","eslint":"^3.12.1","flow-bin":"^0.37.0","mocha":"^3.2.0","nyc":"^10.0.0","source-map-support":"^0.4.6"},"nyc":{"require":["babel-register"],"sourceMap":false,"instrument":false},"homepage":"https://github.com/basicdays/node-stream-to-async-iterator#readme","_id":"stream-to-async-iterator@0.2.0","_shasum":"bef5c885e9524f98b2fa5effecc357bd58483780","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"basicdays","email":"info@basicdays.com"},"dist":{"shasum":"bef5c885e9524f98b2fa5effecc357bd58483780","size":5885,"noattachment":false,"key":"/stream-to-async-iterator/-/stream-to-async-iterator-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-to-async-iterator/download/stream-to-async-iterator-0.2.0.tgz"},"maintainers":[{"name":"basicdays","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/stream-to-async-iterator-0.2.0.tgz_1486335748549_0.5229102412704378"},"directories":{},"publish_time":1486335750474,"_hasShrinkwrap":false,"_cnpm_publish_time":1486335750474,"_cnpmcore_publish_time":"2021-12-17T02:57:19.337Z"}},"readme":"# Stream To Async Iterator [![npm version](https://badge.fury.io/js/stream-to-async-iterator.svg)](https://www.npmjs.com/package/stream-to-async-iterator) ![build](https://github.com/basicdays/node-stream-to-async-iterator/actions/workflows/build.yml/badge.svg)\n\n## Overview\n\n`stream-to-async-iterator` provides a wrapper that implements `Symbol.asyncIterator`. This will allow streams to be\nusable as async iterables that can be used in for-await-of loops.\n\nSupports node.js 12 and up.\n\n## Installation\n\nWith NPM:\n\n```shell\nnpm install stream-to-async-iterator\n```\n\nWith Yarn:\n\n```shell\nyarn add stream-to-async-iterator\n```\n\nThe included examples use async/await syntax for for-of loops. This assumes you are in an environment that natively\nsupports this new syntax, or that you use a tool such as Babel. In addition, for async iterators to work properly,\nthe `Symbol.asyncIterator` symbol must be defined. Core-js can help with that.\n\n## Usage\n\nImport the StreamToAsyncIterator class and pass the stream to its constructor. The iterator instance can be directly\nused in for-of contexts.\n\nIf the stream is in object mode, each iteration will produce the next object. See the\n[node documentation](https://nodejs.org/dist/latest-v6.x/docs/api/stream.html#stream_types_of_streams) for more\ninformation.\n\n```js\n#!/usr/bin/env node\n\"use strict\";\nconst { Readable } = require(\"stream\");\nconst S2A = require(\"../\").default;\n\n(async function () {\n    const readStream = Readable.from([1, 2, 3]);\n    for await (const chunk of new S2A(readStream)) {\n        console.dir({ chunk });\n    }\n})();\n```\n\nOutputs:\n\n```\n{ chunk: 1 }\n{ chunk: 2 }\n{ chunk: 3 }\n```\n\n## References\n\n-   https://github.com/tc39/proposal-async-iteration\n-   https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-generator-functions\n","_attachments":{},"homepage":"https://github.com/basicdays/node-stream-to-async-iterator#readme","bugs":{"url":"https://github.com/basicdays/node-stream-to-async-iterator/issues"},"license":"MIT"}