Promise queue with concurrency control, version 9.3.0. Feature-complete library by Sindre Sorhus for rate-limiting async operations. Useful for REST API calls, CPU/memory intensive tasks, and batch processing. Supports concurrency limits, per-task timeouts, priority queuing, and rate limiting via interval caps. ESM-only since v7; requires Node.js >=20. Alternative to bottleneck, async.queue, or p-limit with richer scheduling features.
npm install p-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 rate limit (5 requests/sec). Adds fetch tasks and waits for all results.
Convert project to ESM or use v6 (CommonJS).
Upgrade Node.js to >=20.
Use a custom PriorityQueue class with filter logic instead.
Use `import PQueue from 'p-queue'`.
Use `if (error.message === 'Operation timed out')` or handle via rejection.
Run `npm install p-queue` and ensure using ESM: `import PQueue from 'p-queue'`
Use `import` syntax or downgrade to p-queue v6 (but note v6 is older).
Use default import: `import PQueue from 'p-queue'` then `new PQueue()`.
Access `queue.size` instead of `queue.size()`.