Registry / testing / p-queue-es5

p-queue-es5

JSON →
library6.0.2jsnpmunverified

Promise queue with concurrency control, priority, and rate limiting. Version 6.0.2 is stable and maintained. Allows limiting concurrent async operations, per-operation timeouts, interval-based rate limiting, and priority scheduling. Compatible with ES5 environments like older Node.js and some bundlers. Built as CommonJS with TypeScript declarations. No native dependencies. Lightweight alternative to bottleneck, p-limit, or async.queue.

npm install p-queue-es5
INSTALL
IMPORT
SIG · P-QUEUE-ES5
P
p-queue-es5
testingjavascriptv6.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import PQueue from 'p-queue-es5';
const PQueue = require('p-queue-es5'); // CJS require yields {default: PQueue}
p-queue-es5 ships as CommonJS with a default export. Use require('p-queue-es5').default in CJS environments.
PQueue
const {default: PQueue} = require('p-queue-es5');
const PQueue = require('p-queue-es5'); // This gives the module object, not the constructor
CommonJS destructuring of default export is idiomatic in Node.
PQueue (type)
import type PQueue from 'p-queue-es5';
import PQueue from 'p-queue-es5'; // Importing type as value causes runtime error
For TypeScript type-only imports, use 'import type' to avoid importing the constructor as a value.

Creates a queue with concurrency 2 and rate limit of 5 tasks per second, adds 10 tasks, and waits for all to finish.

import PQueue from 'p-queue-es5'; const queue = new PQueue({ concurrency: 2, interval: 1000, intervalCap: 5 }); async function doSomething(data) { // Simulate async work await new Promise(resolve => setTimeout(resolve, 500)); console.log('Processed:', data); } for (let i = 0; i < 10; i++) { queue.add(() => doSomething(i)); } await queue.onIdle(); console.log('All tasks completed.');
Debug
Known issues
deprecatedp-queue v7 drops Node.js 8 support and uses ES modules; p-queue-es5 is frozen at v6.0.2.
fix
Consider upgrading to p-queue v7+ for ESM and new features, but note p-queue-es5 will not receive updates.
affects: >=6.0.0 <7
breakingv6 changed default export from PQueue constructor to an object with default property in CJS.
fix
Use `const {default: PQueue} = require('p-queue-es5')` or `import PQueue from 'p-queue-es5'`.
affects: >=6.0.0
gotchaEvent emitter 'active' is emitted for each item processed; but if queue is paused, events are delayed.
fix
Ensure queue is started (start()) after adding tasks if autoStart is false.
affects: >=5.0.0
gotchatimeout option can cause unhandled promise rejections if throwOnTimeout is false and no error handling is added.
fix
Always handle promise rejections when using timeout with throwOnTimeout: false.
affects: >=5.0.0
deprecatedp-queue-es5 is a separate, legacy package; use p-queue for modern Node.js (>=10).
fix
Install 'p-queue' instead of 'p-queue-es5' for non-ES5 environments.
affects: >=6.0.0
Errors
Common errors & fixes
TypeError: PQueue is not a constructor
Using require('p-queue-es5') which returns the module object, not the constructor.
fix
Use const {default: PQueue} = require('p-queue-es5') or import PQueue from 'p-queue-es5'.
Cannot find module 'eventemitter3'
Missing dependency eventemitter3 (used internally by p-queue).
fix
Run npm install p-queue-es5 which includes eventemitter3 as a dependency.
TypeError: queue.add is not a function
Using a string or non-function as the first argument to add() instead of a function.
fix
Pass a function (sync or async) that returns a promise: queue.add(() => myAsyncFunction()).
TypeError: queue.onEmpty is not a function
Using .onEmpty() before queue is instantiated or after it was destroyed.
fix
Only call .onEmpty() on a valid PQueue instance. It returns a promise, not a function.
Upgrade
Version history
6.0.2latest on npm
Audit
Dependencies
eventemitter3requiredPQueue extends EventEmitter3 for event support (e.g., 'active' event).
Agent activity
2 hits · last 30 days
node
2
Resources
p-queue-es5 — npm install p-queue-es5 · libregistry