
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Small module for writing async callback code in a more syncrinous way using generator functions.
Small module for writing async callback code in a more syncrinous way using generator functions.
useage example:
let gensync = require('gensync-cb'),
fs = require('fs');
function processFile(filePath, callback){
gensync.syncronise(function*(resume){
var [exists] = yield fs.exists(filePath, resume);
if(!exists) return callback('file not found');
var [error, fileContent] = yield fs.readFile(filePath, 'utf8', resume);
if(error) return callback(error);
//do some processing
var newFileContent = '';
var [error] = yield fs.writeFile(filePath, newFileContent, resume);
if(error) return callback(error);
callback(null, `processed file ${filePath}`);
});
}
processFile('file.txt', console.log);
Also includes a helper function for running multiple async functions in parallel, with the option to limit the number of functions running simultaniously.
let funcs = [cb=>processFile('file.txt', cb), cb=>processFile('file2.txt', cb)];
gensync.parallel(5, false, funcs, () => console.log('done processing files'));
//same as above, curried
gensync.parallelCurry(5)(false)(funcs)(() => console.log('done processing files'));
FAQs
Small module for writing async callback code in a more syncrinous way using generator functions.
We found that gensync-cb 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.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.