
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
simple-worker-thread-queue
Advanced tools
Simple Node.js queue that executes jobs asynchronously with worker threads
Provides an simply in-memory queue that manages the processing of jobs. Jobs are processed asychronously with Node.js Worker Threads.
Queue behavior is as follows:
CONCURRENT_WORKER_THREADS configuration in a .env file is greater than 1To install as a dependency in your project:
npm install simple-worker-thread-queue
Typescript examples are available in ./examples/typescript, but the basic steps are:
processJob.// CustomWorker.js
export async function processJob (jobOptions, job) {
const result = {
message: `Hello ${jobOptions.name}`,
};
// result will be saved to the job data
return result;
};
Queue in your project file and pass the absolute path to the file exporting processJob.import { Queue } from 'simple-worker-thread-queue';
const queue = new Queue({
processJobExportPath: path.join(__dirname, './CustomWorker.js')
});
Job to the Queue. Monitor Job completion with a completionCallback function.const completionCallback = async (completedJob) => {
console.log(`job ${completedJob.getId()} completed with result: ${completedJob.getData().message}`);
};
const jobOptions = {
name: 'Taylor',
completionCallback,
};
const job = queue.add(jobOptions);
Jobs can be grouped together into a Batch. By supplying a batch completion callback function, consuming services can be nofitied when the processing of the batched jobs is complete.
import { Batch } from 'simple-worker-thread-queue';
const completionCallback = async function (completedBatch) {
console.log(`batch ${completedBatch.getId()} completed with ${completedBatch.getJobs().length} jobs`);
}
const batch = new Batch(completionCallback);
// add jobs to queue with batch parameter
const job1 = queue.addToBatch(job1Options, batch);
const job2 = queue.addToBatch(job2Options, batch);
When AWS announced it would be discontinuing support for their Elastic Transcoder service, I created a small REST-based service to replace it. As part of this service I needed simple job queuing, with job processing offloaded so the main thread could handle further REST requests.
Existing queuing solutions like BullMQ were feature rich but overkill. I spun the queueing code I created off as a seperate npm package incase it could be used else-where.
FAQs
Simple Node.js queue that executes jobs asynchronously with worker threads
We found that simple-worker-thread-queue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.