UNPKG

threadwarden

Version:

A high-performance Node.js library that distributes work across multiple CPU cores using worker threads with automatic load balancing

10 lines (9 loc) 324 B
const { parentPort, workerData } = require('worker_threads'); const mainworker = require(workerData.workerFile); parentPort.on('message', (message) => { const res = { data:mainworker(message.mesaj, workerData.workerId), messageId: message.messageId, } parentPort.postMessage(res); });