Higher-level worker threads for JavaScript.
npm i bare-worker
const Worker = require('bare-worker')
if (Worker.isMainThread) {
const worker = new Worker(__filename)
worker
.on('message', console.log)
.on('exit', (code) => {
console.log('Worker exited with code', code)
})
} else {
Worker.parentPort.postMessage('Hello worker')
}
Apache-2.0