mini-worker

1.0.1 • Public • Published

Mini Worker

Working example implementation of "worker_threads"

Use

const miniWorker = require('mini-worker');
 
// simple
miniWorker.simple(pathScript, data);
 
// sliced
miniWorker.sliced(pathScript, array, maxThreads);

Work Script (example)

const { workerData, parentPort, threadId } = require('worker_threads');
 
// Your code
console.log(workerData);
 
// parentPort.postMessage('hello world');

Run

node --experimental-worker ./***

Test

# simple 
npm run simpletest
 
# sliced 
npm run slicedtest

Package Sidebar

Install

npm i mini-worker

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

3.98 kB

Total Files

8

Last publish

Collaborators

  • darkjinnee