Registry / devops / async-promise-queue

async-promise-queue

JSON →
library1.0.5jsnpmunverified

Wrapper around async.queue that provides a promise-based API for queueing asynchronous tasks with concurrency control. Current stable version: 1.0.5. Release cadence: infrequent, last updated in 2019. Key differentiators: automatically waits for pending work to finish before rejecting on failure, preventing runaway tasks; also exports a reference to the async module it depends on. Suitable for Node.js environments with Promise-based workflows.

npm install async-promise-queue
INSTALL
IMPORT
SIG · ASYNC-PROMISE-QUEU
A
async-promise-queue
devopsjavascriptv1.0.5
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.

queue
import queue from 'async-promise-queue'
const { queue } = require('async-promise-queue')
Default export is a function; named export 'queue' does not exist.
async
import { async } from 'async-promise-queue'
const async = require('async-promise-queue/async')
The 'async' property is a named export, not a submodule.
default import (function)
const queue = require('async-promise-queue')
const { async } = require('async-promise-queue')
Default CommonJS import is the queue function; destructuring gives async reference.

Shows basic usage: import default function, create a worker that returns a promise, enqueue tasks with concurrency limit, and handle completion or errors.

import queue from 'async-promise-queue'; const worker = (task) => { console.log('Processing', task.file); return new Promise((resolve) => setTimeout(resolve, task.duration)); }; const tasks = [ { file: 'a.txt', duration: 100 }, { file: 'b.txt', duration: 200 }, ]; queue(worker, tasks, 2) .then(() => console.log('All done')) .catch((err) => console.error('Error:', err));
Debug
Known issues
gotchaThe default export is a function, not a named export. CommonJS users often destructure incorrectly.
fix
Use `const queue = require('async-promise-queue')` for CommonJS; `import queue from 'async-promise-queue'` for ESM.
affects: *
gotchaThe worker function must return a promise (or be wrapped with async.asyncify). If a synchronous error is thrown, it may not be caught properly.
fix
Wrap synchronous work in a Promise, or use `queue.async.asyncify(worker)`.
affects: *
deprecatedThe package depends on the `async` module v2.x which may lag behind the latest async releases. No TypeScript types included.
fix
Consider alternative libraries like `p-queue` for better TypeScript support and active maintenance.
affects: *
Errors
Common errors & fixes
TypeError: queue is not a function
Using named import destructuring on CommonJS default export.
fix
Use `const queue = require('async-promise-queue')` or `import queue from 'async-promise-queue'`.
Error: worker is not a function
Passing an async/await function directly without wrapping in asyncify; the library expects a function that takes (task, callback).
fix
Wrap your worker with `queue.async.asyncify(worker)` if using promises.
TypeError: Cannot read property 'async' of undefined
Importing the module incorrectly in an environment that doesn't support module resolution.
fix
Ensure the package is installed and imported correctly with proper module system (require vs import).
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
async-promise-queue — npm install async-promise-queue · libregistry