Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

each-stream

Last version Coverage Status NPM Status

Iterate stream with async and concurrency support.

Install

$ npm install each-stream --save

Usage

const each = require('each-stream')

const stream = await db.users.find({}, { stream: true })

await each(stream, async user => {
  const stats = await stats.retrieve(user.id)
  return sendEmail(user.id, stats)
}, { concurrency: 10 })

API

each(stream, fn, [options])

stream

Required
Type: object

The Readable stream to iterate.

fn

Required
Type: function

The async function to invoke per every iteration.

options

concurrency

Type: number
Default: Number.MAX_SAFE_INTEGER

The maximum concurrency allowed.

waiting

Type: number
Default: 100

The quantity of time to wait until check if concurrency changed.

License

each-stream © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats

About

Iterate Node.js streams with async iterators, concurrency limits, series or parallel processing.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages