A lightweight job queue for limiting concurrent execution of asynchronous functions. Current stable version is 2.0.0, with low release cadence (last major update in 2020). It implements an Array-like API (push, unshift, splice) to add tasks and supports both callback and promise-based functions. Differentiators: minimal overhead, simple concurrency control (default Infinity), and a clear motivation to avoid performance pitfalls (e.g., zlib with infinite concurrency). Unlike heavyweight libraries like p-limit or bottleneck, it prioritizes simplicity and zero additional dependencies.
npm install async-limiterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a limiter with concurrency 2, pushes two async functions, and logs results when queue finishes.
Update imports to use named import `import { Limiter } from 'async-limiter'` instead of `const Queue = require('async-limiter')`, and ensure your project is configured for ESM.Ensure all jobs are pushed synchronously before expecting onDone() to fire. If you need to add jobs dynamically, call onDone() only when all jobs are queued.
Set a finite concurrency value in the constructor: `new Limiter({ concurrency: 5 })`.No fix available from library. Wrap in a Promise if needed: `await new Promise(resolve => limiter.onDone(resolve))`.
Ensure `done()` is called (even on error) to advance the queue. For promises, the done is handled internally.
Use dynamic import or switch to ESM: `const { Limiter } = await import('async-limiter')`Use `import { Limiter } from 'async-limiter'` or `import Limiter from 'async-limiter'` (if bundler supports default).Job signature: `function(done: () => void) { ... done(); }`. The callback does not accept an error argument.Reduce concurrency or queue size; avoid adding new jobs recursively from within a job.
No dependency data recorded yet.