Registry / testing / js-promise-queue

js-promise-queue

JSON →
library1.1.0jsnpmunverified

Runs JavaScript Promises sequentially with an optional interval. Version 1.1.0 is the latest stable release, last updated in 2019. The package provides a simple function that takes an array of items and a factory function returning promises, executing them one after another. An interval option allows adding a delay between each promise. It has no external dependencies. Differentiators: minimal API, no configuration overhead, pure promise-based sequential execution.

npm install js-promise-queue
INSTALL
IMPORT
SIG · JS-PROMISE-QUEUE
J
js-promise-queue
testingjavascriptv1.1.0
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.

promiseQueue
const promiseQueue = require('js-promise-queue')
import promiseQueue from 'js-promise-queue'
Package uses CommonJS; no default ESM export available.
promiseQueue
import promiseQueue from 'js-promise-queue'
ESM import works if using bundler or Node with experimental modules, but the package only provides a CJS export.
default
const promiseQueue = require('js-promise-queue')
const { promiseQueue } = require('js-promise-queue')
The module exports a function directly; named destructuring will result in undefined.

Sequentially process an array of items with a promise-returning factory, adding a 500ms interval between executions.

const promiseQueue = require('js-promise-queue'); const factoryFn = value => { return new Promise((resolve, reject) => { setTimeout(() => resolve(`Processed ${value}`), 1000); }); }; promiseQueue([1, 2, 3], factoryFn, { interval: 500 }) .then(results => { console.log('All done:', results); }) .catch(err => { console.error('Error:', err); });
Debug
Known issues
gotchaIf factory function rejects, the whole queue rejects immediately without processing remaining items.
fix
Handle rejections inside factory or add a catch block per item to avoid queue abort.
affects: >=1.0.0
gotchaThe interval option adds delay between completion of one promise and start of the next, not between invocations.
fix
Verify interval timing in your application logic.
affects: >=1.0.0
deprecatedPackage has not been updated since 2019; may have compatibility issues with modern Node.js or ES module systems.
fix
Consider using p-limit or p-queue for active maintenance and more features.
affects: >=1.0.0
gotchaNo support for concurrency limits; always runs one promise at a time.
fix
Use p-queue with concurrency option if parallel execution needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: promiseQueue is not a function
Destructuring import incorrectly using { promiseQueue }.
fix
Use `const promiseQueue = require('js-promise-queue');`
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Trying to import non-existent ESM export.
fix
Ensure using CommonJS require; package does not export as ES module.
Cannot read property 'then' of undefined
Missing factory function or passing incorrect arguments.
fix
Provide a valid factory function that returns a Promise.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
7
Resources
js-promise-queue — npm install js-promise-queue · libregistry