finds.dev← search

// the find

JacksonTian/bagpipe

★ 320 · JavaScript · NOASSERTION · updated May 2022

Async call limit

Bagpipe is a Node.js concurrency limiter for callback-style async functions. You give it a max concurrency count, push functions and their arguments into it, and it queues the excess. It predates Promise-based concurrency utilities and was built for the Node.js callback era.

The queue backpressure model is sound — the `full` event gives you an observable signal for when your system is falling behind, which most similar utilities skip. The `refuse` option letting you shed load instead of queuing indefinitely is the right default to expose. The EMFILE file descriptor example in the README is a concrete, real use case that actually illustrates why you'd want this. The implementation is tiny — one file, easy to audit.

This is a dead library. Last meaningful activity was years ago and it only works with the Node.js callback convention (last argument must be a callback). In 2024, everyone is using Promises — p-limit, p-queue, or even a simple semaphore pattern handles this better and works with async/await. The `this` binding caveat called out in Best Practices is a footgun that `bind` only partially fixes. There is no support for prioritization, no way to cancel queued calls, and no Promise-returning API — so adopting it today means either staying in callback-land or wrapping everything in promisify, which is more trouble than just using a modern alternative.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →