Registry / devops / qyu
library2.1.3jsnpmunverified

Qyu 2.1.3 (stable, semver releases) is a flexible, promise-based asynchronous job queue for both Node.js (>=10) and browser environments. It prioritizes simplicity and always-on readiness, accepting jobs any time and executing them up to a configurable concurrency limit. Unlike simple async pools, Qyu supports per-job priority, per-job timeout, queue capacity limits, pause/resume, and an AbortSignal. It ships both CJS and ESM builds with full TypeScript type definitions. Key differentiator: designed for large-scale web scrapers and API throttling, with a minimal API surface (the instance itself is callable).

npm install qyu
INSTALL
IMPORT
SIG · QYU
Q
qyu
devopsjavascriptv2.1.3
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.

Qyu
import { Qyu } from 'qyu'
import Qyu from 'qyu'
Named export, not default. Also works with CJS: const { Qyu } = require('qyu')
QyuError
import { QyuError } from 'qyu'
import QyuError from 'qyu'
Named export for error type. Not exported in v1.x
QyuOptions
import { QyuOptions } from 'qyu'
type QyuOptions = ...
TypeScript only: exported type for constructor options object

Shows import, instance creation, job queuing (basic and with options), waiting for queue drain, pause/resume, and capacity error handling.

import { Qyu } from 'qyu'; const q = new Qyu({ concurrency: 3 }); async function fetchCat() { const res = await fetch('https://cataas.com/cat'); await res.blob(); } // Queue three jobs concurrently const result1 = await q(fetchCat); const result2 = await q({ fn: fetchCat, priority: 2 }); // Wait for all queued jobs to finish await q.whenEmpty(); // Pause/resume example q.pause(); q.resume(); // Capacity limit catches errors try { const limited = new Qyu({ capacity: 1 }); limited(job1); limited(job2); // throws QyuError: ERR_CAPACITY_FULL } catch (e) { console.error(e); }
Debug
Known issues
breakingIn Qyu v2, the import changed from default to named export.
fix
Use `import { Qyu } from 'qyu'` instead of `import Qyu from 'qyu'`.
affects: >=2.0.0 <2.0.0
deprecatedThe method `q.push()` was deprecated in v2. Use the instance directly as a function.
fix
Replace `q.push(job)` with `q(job)`.
affects: >=2.0.0
gotchaJobs must be functions returning a promise. Passing non-function or non-promise-returning function will cause runtime errors.
fix
Wrap synchronous code in an async function or return a Promise.
affects: >=1.0.0
gotchaQyu does not automatically handle job errors. Rejected promises propagate to the caller of `q(job)`. Unhandled rejections occur if not caught.
fix
Always await or .catch() the promise returned by q(job).
affects: >=1.0.0
breakingThe `signal` option was removed in v2.1.0; use AbortController via timeout instead.
fix
Use `timeout` option to cancel a job after a duration.
affects: >=2.1.0
Errors
Common errors & fixes
TypeError: (intermediate value) is not a function
Calling the instance with a non-function argument, e.g. q(42).
fix
Ensure argument to q() is a function returning a promise.
QyuError: ERR_CAPACITY_FULL
Attempting to queue a job when the internal queue has reached the `capacity` limit.
fix
Increase `capacity` or wait for jobs to complete before queuing more.
UnhandledPromiseRejectionWarning: [object Object]
A job rejected but the promise from q(job) was not caught/awaited.
fix
Always handle the promise: `q(job).catch(err => ...)` or use try/catch with await.
Cannot find module 'qyu' or 'default' is not exported from 'qyu'
Using `import Qyu from 'qyu'` which assumes a default export, but Qyu is a named export.
fix
Use `import { Qyu } from 'qyu'`.
Upgrade
Version history
2.1.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
packageqyu
qyu — npm install qyu · libregistry