WorkerPool based on cluster that allows executing synchronous functions asynchronously using forks stored in pool
Usage
const isMaster = ;const WorkerPool = ;if isMaster //wrapping all your code into isMaster check is required const hardFunction = { const somelib = ; //require should be inside the function //do some calculations return `Result of calculations #`; }; const pool = 4; const emptyPool = ; emptyPoolallowSpawn = true; //set this flag if you want to allow spawning additional forks const task1 = pool; const task2 = emptyPool; task1promise; task2promise;