0.1.1 • Published 10 years ago
synchronode v0.1.1
Sync module for nodejs
Synchronizing async calls in nodejs (generators + yield)
To install simply run:
npm install synchronode
This turns this:
function logContents(sFileName) {
fs.readFile(sFileName, 'utf8', function(s) {
console.log(s);
});
}
into this:
Sync(function*(sFileName) {
console.log(yield fs.readFile.sync(sFileName, 'utf8'));
});
It also does this for every and any async method with callback specified as last parameter.
Blog post: http://dot-js.blogspot.com/2013/12/nodejs-async-to-sync-using-javascript.html Enjoy!