Registry / testing / zqueue

zqueue

JSON →
library0.1.1jsnpmunverified

A lightweight JavaScript library for queueing and running promise-based jobs with concurrency control. Version 0.1.1 is the latest stable release, with no established release cadence. It allows developers to limit the number of concurrent operations, such as controlling upload bandwidth by restricting simultaneous HTTP requests. Compared to alternatives like p-limit or bottleneck, ZQueue offers a minimal API surface focused solely on concurrency limits. It is CommonJS and supports TypeScript via type definitions.

npm install zqueue
INSTALL
IMPORT
SIG · ZQUEUE
Z
zqueue
testingjavascriptv0.1.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.

ZQueue
import { ZQueue } from 'zqueue'
const ZQueue = require('zqueue')
ESM import is recommended; CommonJS require also works but TypeScript may need esModuleInterop.
ZQueue (default)
import ZQueue from 'zqueue'
const { ZQueue } = require('zqueue')
Package has both named and default exports; default export is the same function.
QueueOptions
import type { QueueOptions } from 'zqueue'
import { QueueOptions } from 'zqueue'
QueueOptions is a TypeScript type, not a runtime value; use 'import type' for correctness.

Creates a queue with max 3 concurrent jobs and uses it to limit parallel HTTP uploads.

import { ZQueue } from 'zqueue'; import axios from 'axios'; const queue = ZQueue({ max: 3 }); const upload = (file: Buffer) => queue.run(() => axios.put('https://example.com/upload', file)); await Promise.all([file1, file2, file3, file4, file5].map(upload)); console.log('All uploads completed.');
Debug
Known issues
gotchaConstructor must be called without 'new'
fix
Use ZQueue({ max: ... }) as a function, not new ZQueue().
affects: >=0.1.0
gotchaJobs are not automatically retried on rejection
fix
Wrap your job logic with try-catch or implement retry manually inside the callback.
affects: >=0.1.0
gotchaQueue object is not iterable; you cannot monitor pending jobs directly
fix
Maintain your own external job tracking if you need to inspect queue state.
affects: >=0.1.0
gotchaLibrary does not support priority or pausing
fix
Use a more feature-rich library like bottleneck or p-limit if advanced control is needed.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: ZQueue is not a constructor
Attempting to use 'new ZQueue()' when ZQueue is a function that returns an object.
fix
Call ZQueue({ max: 3 }) without 'new'.
UnhandledPromiseRejectionWarning: Error: ...
A job in the queue rejected but no .catch() was attached to queue.run().
fix
Attach a catch handler: queue.run(() => promise).catch(err => console.error(err)).
Cannot find module 'zqueue' or its corresponding type declarations.
Missing zqueue package installation or TypeScript cannot locate type definitions.
fix
Run 'npm install zqueue' and ensure tsconfig.json includes 'node_modules/@types' or the package ships types.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
47 hits · last 30 days
node
38
Amazon
1
OpenAI (training)
1
Resources
packagezqueue
zqueue — npm install zqueue · libregistry