r-k-b / backpressure-queue

Pipe nodejs streams into an async.queue for parallelisation, get backpressure when the queue is full.

Home Page:https://www.npmjs.com/package/backpressure-queue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

backpressure-queue

Node.js CI

Returns a Writable ObjectMode Stream that allows a certain number of simultaneous promises, and triggers stream backpressure when the concurrency limit is hit.

Errors are swallowed.

The return value of doWork() is ignored, and cannot be retrieved.

Usage:

async function foo(someItem) {
  console.log('work done on ' + someItem)
  return
}

const w = writableQueue({doWork: foo, limitConcurrent: 2})

someSourceStream.pipe(w)

About

Pipe nodejs streams into an async.queue for parallelisation, get backpressure when the queue is full.

https://www.npmjs.com/package/backpressure-queue

License:GNU General Public License v3.0


Languages

Language:TypeScript 88.2%Language:Nix 9.9%Language:Shell 1.8%