Registry / devops / tasque

tasque

JSON →
library0.1.2jsnpmunverified

A simple TypeScript task queue with parallel execution control, queue capacity limits, position listeners, and async iteration. Stable version 0.1.2, ships TypeScript types, published on npm and JSR. Key differentiators: very low bundle size (<1KB minzip), supports dynamic parallelism scaling, capacity limits, and both positional listeners and async iterable streams for task progress. Peer dependency on TypeScript ^5.0 indicates type-aware usage.

npm install tasque
INSTALL
IMPORT
SIG · TASQUE
T
tasque
devopsjavascriptv0.1.2
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.

createQueue
import { createQueue } from 'tasque'
import createQueue from 'tasque'
Named export, not default.
Queue
import { type Queue } from 'tasque'
import { Queue } from 'tasque'
Type import for TypeScript; Queue is not a value.
AddOptions
import { type AddOptions } from 'tasque'
Type import for options object.

Demonstrates queue creation with parallelism and capacity, adding async and sync tasks with a position listener, and using the async iterable stream.

import { createQueue } from 'tasque'; const queue = createQueue({ parallelize: 2, max: 10 }); queue.add(async () => { await new Promise(resolve => setTimeout(resolve, 1000)); return 'done'; }); queue.add(() => 'sync done', (pos) => { console.log('Position:', pos); }); const iterable = queue.iterate(async () => 'streamed'); if (iterable) { for await (const [pos, value] of iterable) { console.log(pos, value); } }
Debug
Known issues
gotchaAdding more tasks than `max` returns `null` instead of a Promise
fix
Always check the return value of `add` for null before awaiting.
affects: >=0.1.0
gotchaSetting `parallelize` to 0 or negative might cause unexpected behavior
fix
Always set `parallelize` to a positive integer (>=1).
affects: >=0.1.0
gotcha`iterate` returns `null` if queue capacity is unlimited (max is undefined or Infinity)
fix
Set `max` to a finite number to use `iterate`.
affects: >=0.1.0
gotchaChanging `parallelize` down does not stop running tasks; only queued tasks wait
fix
Consider this when designing behaviour; running tasks must complete or be aborted externally.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: queue.iterate is not a function
Attempting to call `iterate` on a queue with no `max` set
fix
Create queue with `max` option: `createQueue({ max: 10 })`
Property 'parallelize' does not exist on type 'Queue'
Using older version before parallelize was added (v0.1.0?)
fix
Update to version 0.1.x: `npm install tasque@latest`
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
packagetasque
tasque — npm install tasque · libregistry