pull-stream-to-async-iterator
Convert a pull stream to an async iterator
Last updated 7 years ago by alanshaw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pull-stream-to-async-iterator 
SYNC missed versions from official npm registry.

pull-stream-to-async-iterator

Build Status dependencies Status

Convert a pull stream to an async iterator

Install

npm install pull-stream-to-async-iterator

Usage

const toIterator = require('pull-stream-to-async-iterator')

const source = pull(
  pull.values([1, 2, 3, 4, 5]),
  pull.asyncMap((value, cb) => setTimeout(() => cb(null, value)))
)
const iterator = toIterator(source)

for await (const value of iterator) {
  console.log(value)
}

API

toIterator(source)

Convert a source pull stream into an async iterator. Returns an async iterator that can be used in a for/await/of loop.

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Alan Shaw

Current Tags

  • 1.0.2                                ...           latest (7 years ago)

3 Versions

  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)

Copyright 2013 - present © cnpmjs.org | Home |