Registry / devops / easy-promise-queue

easy-promise-queue

JSON →
library0.5.7jsnpmunverified

A lightweight, concurrency-controlled promise queue for Node.js (v0.5.7, last updated 2020). Executes promises in FIFO order with configurable concurrency. Supports pause/resume of the queue (ongoing promises complete). Includes TypeScript definitions. Differentiates from similar libraries (e.g., p-limit, bottleneck) by built-in pause/resume and simple API. No external dependencies. Stable but low release cadence; works with Node >=8.

npm install easy-promise-queue
INSTALL
IMPORT
SIG · EASY-PROMISE-QUEUE
E
easy-promise-queue
devopsjavascriptv0.5.7
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 PromiseQueue from 'easy-promise-queue'
import { PromiseQueue } from 'easy-promise-queue'
Package exports a class as default export. Named import with curly braces will not work.
default (require)
const PromiseQueue = require('easy-promise-queue').default
const PromiseQueue = require('easy-promise-queue')
CommonJS require must access .default property because the module uses default export.
PromiseQueue
const pq = new PromiseQueue({ concurrency: 2 })
const pq = new PromiseQueue.default({ concurrency: 2 })
After importing the class, instantiate directly. Do not use .default after import.

Creates a queue with concurrency 2, adds promise-returning tasks, demonstrates pause/resume and multiple add patterns.

import PromiseQueue from 'easy-promise-queue'; const queue = new PromiseQueue({ concurrency: 2 }); const task1 = () => new Promise(resolve => { setTimeout(() => { console.log('task 1'); resolve(); }, 1000); }); const task2 = () => new Promise(resolve => { setTimeout(() => { console.log('task 2'); resolve(); }, 500); }); queue.add(task1); queue.add(task2); queue.pause(); queue.resume(); // Add multiple at once: queue.add([task1, task2]); // Chaining: queue.add(task1).add(task2);
Debug
Known issues
breakingimport path changed: previously, default export was accessed differently
fix
Use default import for ESM or .default for CJS as shown in imports.
affects: <0.5.0
deprecatedThe package is not actively maintained; last release in 2020. Might not work with latest Node versions without transpilation.
fix
Consider migrating to actively maintained alternatives like p-limit, bottleneck, or p-queue.
affects: >=8.0.0
gotchaUse add() with arrays: passing an array of thunks adds them all, but the order may be interleaved if concurrency >1.
fix
For strict ordering with concurrency >1, add tasks individually.
affects: >=0.0.0
gotchaPause does NOT stop currently running promises; they complete. Only pending tasks are delayed.
fix
To cancel running tasks, you must use AbortController or similar mechanism outside the queue.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: PromiseQueue is not a constructor
Using named import instead of default import in ESM, or forgetting .default when using require.
fix
Use import PromiseQueue from 'easy-promise-queue' or const PromiseQueue = require('easy-promise-queue').default.
Cannot find module 'easy-promise-queue'
Package not installed or typo in package name.
fix
Run npm install easy-promise-queue. Ensure package.json lists it.
ERR_REQUIRE_ESM
Using CJS require() on an ES module package; the package may be configured as ESM in newer versions (but current 0.5.7 is CJS).
fix
If using an old Node version, verify package supports require. For Node >=12, use import or dynamic import().
Upgrade
Version history
0.5.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
easy-promise-queue — npm install easy-promise-queue · libregistry