
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
Distributes the processing of a list of items over all available CPUs.
1/ install the package:
npm install --save-dep multicpu
2/ Have a look at the example app.js
const multicpu = require("multicpu");
/**
* build and return a list of items, to be sent to each worker
* @param {int} cpu number of CPU to be used
* @returns {array} array of items, which will be sent one by one to the workers
*/
function start(cpu) {
console.log("#CPU ", cpu);
// build an array of N entries.
let arr = [];
for (let i = 2; i < 20; i++)
arr.push({
wait:i,
detail:`will wait for ${i} seconds`
});
return arr;
}
/**
* process an item from the list built by start, spread over workers running on all CPUs. n this example, wait for the numer of seconds provided in parameters
* @async
* @param {object} item one item of the list provided by start
*/
async function processing(item) {
console.log(`${process.pid} processing`, item);
let p = new Promise((resolve) => {
setTimeout(() => {
console.log(`has waited ${item.wait} seconds`);
resolve();
}, item.wait * 1000);
});
await p;
return item.wait
}
/**
* called at the end of whole processing for master to do whatever work
* @param {Object} list - list of {req,res,pid}
* @param {Object} list.req - item from request
* @param {Object} list.res - result from processing
* @param {Object} list.pid - pid which did the processing
*/
function end(list) {
console.log("end is called with this list",list);
var dt = new Date();
console.log(dt.toString());
}
multicpu.start({
start: start,
process: processing,
end: end
});
© 2018-2019 devbab
FAQs
distributes tasks on all available CPUs. Based on Cluster module
We found that multicpu demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.