Registry / devops / forkqueue

forkqueue

JSON →
library0.0.8jsnpmunverified

ForkQueue is a simple Node.js queue library (v0.0.8) that uses child_process.fork to distribute queue items to worker processes. Workers request the next item via 'next' messages, enabling parallel processing. It has no dependencies, is minimal and lightweight, but is in early development with no recent updates (last release 0.0.8). Unlike Bull or Bee-Queue, it lacks persistence, prioritization, or advanced features. Suitable for basic parallel task processing in Node.js.

npm install forkqueue
INSTALL
IMPORT
SIG · FORKQUEUE
F
forkqueue
devopsjavascriptv0.0.8
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.

Queue
const Queue = require('forkqueue');
import Queue from 'forkqueue';
Package uses CommonJS; no default export available for ESM import.
New Queue
const queue = new Queue(5, './worker.js');
const queue = new Queue('5', './worker.js');
First argument must be a number (worker count), second is a string path.
queue.enqueue
queue.enqueue(value);
No return value; call synchronously.

Creates a queue with 2 workers, enqueues 10 items, and processes them using a worker module.

const Queue = require('forkqueue'); const queue = new Queue(2, './worker.js'); for (let i = 0; i < 10; i++) { queue.enqueue(i); } queue.end(() => { console.log('All workers finished'); }); // worker.js: // process.send('next'); // process.on('message', (value) => { // console.log('Processing:', value); // process.send('next'); // });
Debug
Known issues
gotchaWorker module path must be absolute or relative to the current working directory
fix
Use path.resolve if unsure: new Queue(2, path.resolve(__dirname, 'worker.js'))
affects: >=0.0.0
gotchaWorker must send 'next' message before and after processing to continue receiving items
fix
Ensure process.send('next') is called initially and after each message.
affects: >=0.0.0
breakingNo error handling for worker crashes; if a worker exits unexpectedly, the queue may hang
fix
Consider implementing custom worker monitoring or use a more robust queue library.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Queue is not a constructor
Using ESM import (import Queue from 'forkqueue') with CommonJS module
fix
Use const Queue = require('forkqueue');
Error: Cannot find module './worker.js'
Worker path is not correctly resolved
fix
Provide absolute path or ensure relative path is correct from process.cwd()
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

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