IWorker
Promise-based wrapper for worker_threads
Install
npm install iworker
Using
const WorkerGroup = ;const wg = ;
Object schema based
Just put object schema with methods and magical iworker do others
const worker = wg; await worker; // foobarbaz
Factory based
You can define methods from factory-function
const worker = wg; await worker; // Buffer(32)
Emit events during execution
When you want to send some events during the execution of the function
const worker = wg; const res = await worker ; // res - "baz"
Send transferable objects
Instead of copying data, you can move them using Worker Transferable Objects
const worker = wg; const buf = Buffer;const hex = buf; const res = await worker;assert;assert;
Return transferable objects from worker
const worker = wg; const buf = await worker;
Pure event-emitter
You can use iworker as pure event-emitter
const worker = wg; worker; worker;