best-queue is a lightweight, TypeScript-friendly library for controlling asynchronous task execution with concurrency limits, intervals, and error handling. Current stable version is 3.0.7, released under MIT license. It allows developers to create a queue that processes tasks (including Promises) with configurable max concurrency (default 1) and interval between tasks (default 0ms). Key differentiators include optional error recording (recordError mode to continue on failure), pause/resume functionality, and support for both ESM and CommonJS. Compared to similar libraries like p-limit or promise-queue, best-queue provides a single function API with built-in interval control and batch concurrency with fallback to slow tasks.
npm install best-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a queue with concurrency 2 and 1-second interval, processing an array of synchronous values with error recording enabled.
Set `recordError: true` to continue on errors; errors are collected in the results array instead of rejecting.
Always provide a positive integer for max parallel tasks.
Adjust interval logic if expecting per-task delay; this is by design for concurrency.
Migrate from `import Queue from 'best-queue'` to `import { createQueue } from 'best-queue'`.Replace with: import { createQueue } from 'best-queue';Ensure you are using a version that provides proper CJS support (>=3.0.0). For Node.js, use ESM imports or ensure transpilation.