Registry / devops / rp-queue

rp-queue

JSON →
library1.1.0jsnpmunverified

A lightweight promise queue for Node.js (v4+) that runs tasks with concurrency control, rate limiting, and priority support. Version 1.1.0 is the current stable release; updates are infrequent. Key differentiators include support for both simple task arrays and object-style configurations with custom process functions, as well as FIFO and priority queue modes. Unlike larger libraries like Bull or Bee-Queue, rp-queue is minimal and has no dependencies.

npm install rp-queue
INSTALL
IMPORT
SIG · RP-QUEUE
R
rp-queue
devopsjavascriptv1.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.

RPQueue
import RPQueue from 'rp-queue'
const { RPQueue } = require('rp-queue')
Default export only; named import fails.
default import (CommonJS)
const RPQueue = require('rp-queue')
const { RPQueue } = require('rp-queue')
Package does not support ESM; use require.
type import (TypeScript)
import RPQueue from 'rp-queue'
import { RPQueue } from 'rp-queue'
No type definitions shipped; use @types or any.

Basic concurrency control and custom process function usage.

const RPQueue = require('rp-queue'); const tasks = [ () => fetch('https://api.example.com/1'), () => fetch('https://api.example.com/2'), () => fetch('https://api.example.com/3'), () => fetch('https://api.example.com/4'), () => fetch('https://api.example.com/5') ]; // Run at most 2 concurrent tasks RPQueue(tasks, 2).then(() => { console.log('All tasks done'); }); // With custom process function const items = [1, 2, 3, 4, 5]; RPQueue(items, { limit: 2, process: (item) => Promise.resolve(item * 2) }).then(results => { console.log(results); // [2, 4, 6, 8, 10] });
Debug
Known issues
gotchaTasks must return promises; non-promise returns may cause unexpected behavior.
fix
Ensure every task function returns a Promise.
affects: >=1.0.0
gotchaThe limit option defaults to 1 if not provided; omitting it runs tasks sequentially.
fix
Specify a limit > 1 for concurrency.
affects: >=1.0.0
gotchaWhen using process option, results are in insertion order, not completion order.
fix
Use priority or separate ordering mechanism if needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: RPQueue is not a constructor
Named import instead of default import in CommonJS or ESM.
fix
Use 'const RPQueue = require('rp-queue')' or 'import RPQueue from 'rp-queue'.
UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
Using fetch in Node.js without a polyfill.
fix
Install 'node-fetch' or use 'axios' in Node < 18.
TypeError: tasks is not iterable
Passing a non-array or non-iterable as tasks.
fix
Ensure tasks is an array or iterable of functions/items.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
rp-queue — npm install rp-queue · libregistry