{"id":45722,"library":"p-queue-multi","title":"PQueue","description":"A promise queue with concurrency control, rate-limiting, priority, timeout, and abort support. Current stable version is 8.0.4, a fork of the popular p-queue library modified to support both CommonJS and ESM without the original's ESM-only restriction. Released in lockstep with upstream but may bump minor versions independently. Key differentiators: works in CJS and ESM (unlike p-queue v7+ which is ESM-only), EventEmitter3-based, supports interval-based rate limiting, priority queuing, and AbortSignal cancellation. Useful for rate-limiting async operations like REST API calls or CPU/memory intensive tasks.","status":"active","version":"8.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/aeolun/p-queue","tags":["javascript","promise","queue","enqueue","limit","limited","concurrency","throttle","throat","typescript"],"install":[{"cmd":"npm install p-queue-multi","lang":"bash","label":"npm"},{"cmd":"yarn add p-queue-multi","lang":"bash","label":"yarn"},{"cmd":"pnpm add p-queue-multi","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"PQueue extends EventEmitter3 for event handling","package":"eventemitter3","optional":false}],"imports":[{"note":"Default export. In CommonJS, you can use const PQueue = require('p-queue-multi').default or set the package in a way that allows require directly. The package supports both CJS and ESM.","wrong":"const PQueue = require('p-queue-multi').default","symbol":"PQueue","correct":"import PQueue from 'p-queue-multi'"},{"note":"There is no named export; only default export.","wrong":"","symbol":"PQueue as named","correct":"import { default as PQueue } from 'p-queue-multi'"},{"note":"TypeScript types are included. Types are exported under the same path.","wrong":"","symbol":"Type: DefaultAddOptions","correct":"import type { DefaultAddOptions } from 'p-queue-multi'"},{"note":"PriorityQueue is a named export (a class implementing queue interface). In CJS, use const { PriorityQueue } = require('p-queue-multi').","wrong":"const PriorityQueue = require('p-queue-multi').PriorityQueue","symbol":"PriorityQueue","correct":"import { PriorityQueue } from 'p-queue-multi'"}],"quickstart":{"code":"import PQueue from 'p-queue-multi';\nimport got from 'got';\n\nconst queue = new PQueue({ concurrency: 1, interval: 1000, intervalCap: 5 });\n\nasync function example() {\n  const result = await queue.add(async () => {\n    const response = await got('https://api.example.com/data', { timeout: 5000 });\n    return response.body;\n  }, { priority: 10 });\n  console.log('Result:', result);\n}\n\nexample().catch(console.error);","lang":"typescript","description":"Creates a PQueue with concurrency 1 and rate limiting, adds a task with priority, and logs the result."},"warnings":[{"fix":"Use require('p-queue-multi').default instead of require('p-queue-multi') or switch to dynamic import()","message":"p-queue-multi v7+ breaks CommonJS require without .default","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade Node.js to version 18 or later","message":"p-queue-multi v8+ requires Node.js >=18","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Set throwOnTimeout: true if you want timeout to reject the promise","message":"The `timeout` option without `throwOnTimeout: true` will still resolve the promise, not reject","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Always attach .catch() to the promise returned by queue.add()","message":"Unhandled promise rejections from queue.add() may crash process if task throws","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass the signal to your async function and listen for abort events","message":"The `signal` option only cancels pending tasks, not running ones; abortSignal must be handled by the task itself","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Set carryoverConcurrencyCount: true if pending tasks should count toward intervalCap","message":"Interval-based rate limiting resets per interval, but carryoverConcurrencyCount defaults to false, meaning pending tasks from previous interval are not counted","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"search_vec":"'8.0.4':20 'abort':14 'abortsign':85 'api':96 'async':92 'base':75,79 'bump':52 'call':97 'cancel':86 'cjs':60 'commonj':34 'concurr':6,108 'control':7 'cpu/memory':99 'current':16 'differenti':57 'enqueu':105 'esm':36,42,62,71 'esm-on':41,70 'eventemitter3':74 'eventemitter3-based':73 'fork':22 'independ':55 'intens':100 'interv':78 'interval-bas':77 'javascript':102 'key':56 'librari':29 'like':94 'limit':10,81,91,106,107 'lockstep':47 'may':51 'minor':53 'modifi':30 'oper':93 'origin':39 'p':27,65 'p-queue':26,64 'popular':25 'pqueue':1 'prioriti':11,82 'promis':3,103 'queu':83 'queue':4,28,66,104 'rate':9,80,90 'rate-limit':8,89 'releas':45 'rest':95 'restrict':44 'stabl':17 'support':15,32,76 'task':101 'throat':110 'throttl':109 'timeout':12 'typescript':111 'unlik':63 'upstream':49 'use':87 'v7':67 'version':18,54 'without':37 'work':58","created_at":"2026-06-07T12:56:24.050973+00:00","updated_at":"2026-06-07T12:56:24.050973+00:00","problems":[{"fix":"Use const PQueue = require('p-queue-multi').default","cause":"In CommonJS, require returns an ESM module with default export as module.exports.default","error":"p-queue-multi is not a constructor"},{"fix":"Run npm install p-queue-multi and ensure Node.js >=18","cause":"Package not installed or Node.js version <18","error":"Cannot find module 'p-queue-multi'"},{"fix":"Ensure you're using the PQueue class correctly: const queue = new PQueue()","cause":"Instantiating PQueue incorrectly (e.g., using new on default object without .default)","error":"TypeError: queue.add is not a function"},{"fix":"Add .catch() to queue.add() promise or use try/catch with await","cause":"Task added to queue rejected and no .catch() attached to the returned promise","error":"UnhandledPromiseRejectionWarning"},{"fix":"Check if the abort signal is being correctly used and handle the rejection gracefully","cause":"AbortSignal was triggered before task started","error":"AbortError: The operation was aborted"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/aeolun/p-queue#readme","github":"https://github.com/aeolun/p-queue","docs":null,"changelog":null,"pypi":null,"npm":"p-queue-multi","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}