{"_id":"@akst.io/stream-to-async-iterator","_rev":"1-8870992c4c7892577f6251584a262c84","name":"@akst.io/stream-to-async-iterator","description":"ES async interator wrapper for node streams","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.2":{"name":"@akst.io/stream-to-async-iterator","version":"0.2.2","description":"ES async interator wrapper for node streams","main":"stream-to-async-iterator.js","publishConfig":{"access":"public"},"scripts":{"build":"make -j4 build","test":"make full-test"},"repository":{"type":"git","url":"git+https://github.com/akst/node-stream-to-async-iterator.git"},"keywords":["node","stream","async-iterator","promise","esnext"],"authors":[{"name":"Angus Thomsen","email":"hmu@akst.io","url":"http://www.akst.io"}],"license":"MIT","bugs":{"url":"https://github.com/akst/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/akst/node-stream-to-async-iterator#readme","_id":"@akst.io/stream-to-async-iterator@0.2.2","_npmVersion":"5.0.3","_nodeVersion":"8.1.4","_npmUser":{"name":"akst","email":"aksthomsen@gmail.com"},"dist":{"integrity":"sha512-FeZgzq19TMODsSHqpIvtHAFz59aAHcoY9gZXGSnKX+UVrTTYOZvO4+x2oyBSDUtHrnyr3vDuq/lz3dd+8mjl8Q==","shasum":"a8473420bd9fb48eaf3d6b9816e4087dde15d1de","tarball":"https://registry.npmjs.org/@akst.io/stream-to-async-iterator/-/stream-to-async-iterator-0.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClTFt2TZMpENoXozmW0kNbyaGsN28y3pEL6HcvibaTfwIhAIjw3yU5ILPBhJukR6qsmq/pMBXHMAUoXqVr3OXGTJ2m"}]},"maintainers":[{"name":"akst","email":"aksthomsen@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-to-async-iterator-0.2.2.tgz_1500187984104_0.39453054941259325"}}},"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 Status](https://travis-ci.org/basicdays/node-stream-to-async-iterator.svg?branch=master)](https://travis-ci.org/basicdays/node-stream-to-async-iterator)\n\n\n## Overview\n\n`stream-to-async-iterator` provides a wrapper that implements `Symbol.asyncIterator`. This will allow streams to be usable\nas async iterables that can be used in for-await-of loops.\n\nSupports node.js 4 and up.\n\n## Installation\n\n```\n$ npm install stream-to-async-iterator\n```\n\nThe examples provides 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 or `babel-polyfill` can both help with that.\n\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';\nrequire('core-js/es7/symbol');\nconst fs = require('fs');\nconst S2A = require('stream-to-async-iterator');\n\n\n(async function() {\n    const readStream = fs.createReadStream(__filename);\n    for await (const chunk of new S2A(readStream)) {\n        console.log(chunk);\n    }\n})();\n```\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","maintainers":[{"name":"akst","email":"aksthomsen@gmail.com"}],"time":{"modified":"2022-04-04T12:31:31.465Z","created":"2017-07-16T06:53:04.185Z","0.2.2":"2017-07-16T06:53:04.185Z"},"homepage":"https://github.com/akst/node-stream-to-async-iterator#readme","keywords":["node","stream","async-iterator","promise","esnext"],"repository":{"type":"git","url":"git+https://github.com/akst/node-stream-to-async-iterator.git"},"bugs":{"url":"https://github.com/akst/node-stream-to-async-iterator/issues"},"license":"MIT","readmeFilename":"README.md"}