1.0.4 • Published 7 months ago

each-stream v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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

1.0.4

7 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago