Registry / devops / qrate
library2.0.1jsnpmunverified

qrate is a Node.js queue library (v2.0.1, stable, low maintenance) that extends async.queue with configurable concurrency and rate limiting. It allows controlling the maximum number of workers running at any time and limiting the number of workers started per second. Key differentiators vs async: built-in rate limiting without external timers, and a drop-in replacement API. qrate uses an ESM-only module format, no TypeScript types shipped, and works in Node.js environments. It has no external dependencies.

npm install qrate
INSTALL
IMPORT
SIG · QRATE
Q
qrate
devopsjavascriptv2.0.1
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 export
import qrate from 'qrate'
const qrate = require('qrate')
qrate is ESM-only (since v2). CommonJS require() will fail with ERR_REQUIRE_ESM. Use dynamic import() if needed: const qrate = (await import('qrate')).default.
type import (TypeScript)
import type { QRateQueue } from 'qrate'
import { QRateQueue } from 'qrate'
QRateQueue is not exported as a runtime value. Use import type for TypeScript if you only need the type.
queue creation
const q = qrate(worker, concurrency, rateLimit)
const q = qrate({worker, concurrency: 1, rateLimit: null})
qrate takes arguments in order: worker, concurrency (optional), rateLimit (optional). Options object is not supported.

Create a queue with rate limiting (2 jobs/sec) and push 6 items. Worker simulates 100ms async work.

import qrate from 'qrate'; const start = Date.now(); const worker = (task, done) => { console.log('Processing', task, '@', Date.now() - start, 'ms'); setTimeout(done, 100); }; // concurrency 1, rateLimit 2 per second const q = qrate(worker, 1, 2); for (let i = 0; i < 6; i++) { q.push({ i }); }
Debug
Known issues
breakingqrate v2 is ESM-only and does not support CommonJS require().
fix
Use import instead of require, or use dynamic import: const qrate = (await import('qrate')).default
affects: >=2.0.0
deprecatedqrate v1 used CommonJS and is deprecated. v2 uses ES modules.
fix
Upgrade to v2 and switch to ESM imports.
affects: <2.0.0
gotcharateLimit is per second, not per minute or millisecond. rateLimit=0.5 means one job every 2 seconds.
fix
Ensure your rateLimit value matches your desired jobs-per-second (not per minute).
affects: *
gotchaThe queue does not support pausing or resuming like async.queue (no q.pause() or q.resume()).
fix
Do not rely on pause/resume; manage concurrency externally if needed.
affects: *
gotchaqrate does not ship TypeScript definitions. You must provide your own or use @types/qrate if available.
fix
Install @types/qrate or declare a module: declare module 'qrate';
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
qrate v2 is ESM-only, but code uses require('qrate').
fix
Change to import qrate from 'qrate' or use dynamic import().
TypeError: qrate is not a function
Possibly using default import incorrectly or CommonJS require on v2 ESM.
fix
Ensure you are using import qrate from 'qrate' (not { qrate }).
ReferenceError: require is not defined in ES module scope
Using require('qrate') in an ESM context.
fix
Use import statement instead.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
packageqrate
qrate — npm install qrate · libregistry