Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Library shrinks a given callback parallel execution concurrency in a limited number of threads, receiving the bunch of data (array of tasks).
node-narrow is a library which shrinks a given callback parallel execution in a limited number of threads, receiving the bunch of data (array of tasks).
Inspired from node-async#queue.
Push a big bunch of data and handle it in maximum 5 simultaneous threads:
var Narrow = require('narrow');
var narrow = new Narrow(5, function(str, callback){
setTimeout(function(){
callback(null, str.toUpperCase());
}, 1000)
})
var tasks = [];
for (var i = 0; i < 10; i++) {
tasks.push('something' + i);
}
var start = new Date;
narrow.on('complete', function(result){
console.log('%s after %dms', result, new Date - start);
});
narrow.pushAll(tasks, function(){
console.log('done');
})
Will output:
SOMETHING0 after 1002ms
SOMETHING1 after 1012ms
SOMETHING2 after 1012ms
SOMETHING3 after 1012ms
SOMETHING4 after 1012ms
SOMETHING5 after 2012ms
SOMETHING6 after 2012ms
SOMETHING7 after 2013ms
SOMETHING8 after 2016ms
SOMETHING9 after 2016ms
done
Timeouts support
todo: document
See more examples in examples directory.
npm install narrow
FAQs
Library shrinks a given callback parallel execution concurrency in a limited number of threads, receiving the bunch of data (array of tasks).
The npm package narrow receives a total of 4 weekly downloads. As such, narrow popularity was classified as not popular.
We found that narrow 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.