Skip to content

alanshaw/pull-stream-to-async-iterator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Convert a pull stream to an async iterator

Resources

License

Stars

Watchers

Forks

Packages

No packages published