Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/r-k-b/backpressure-queue

Pipe nodejs streams into an async.queue for parallelisation, get backpressure when the queue is full.
https://github.com/r-k-b/backpressure-queue

backpressure parallel queue streams

Last synced: 26 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# backpressure-queue

![Node.js CI](https://github.com/r-k-b/backpressure-queue/workflows/Node.js%20CI/badge.svg?branch=master)

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)