NodeJs — Worker Threads
The 'worker_threads' module allows you to run JavaScript code in parallel threads. This is useful for CPU-intensive tasks like image processing or data encryption, which would otherwise block the main thread.
const { Worker } = require('worker_threads');
const worker = new Worker(`
const { parentPort } = require('worker_threads');
parentPort.postMessage('Hello from Worker Thread!');
`, { eval: true });
worker.on('message', msg => console.log(msg));