po
v4.5.2
Published
po = promiseify + co
Downloads
63
Maintainers
Readme
po = promiseify + co
usage
var co = require('co');
var po = require('po');
var fsReadFile = po(fs.readFile, fs);
var fsStat = po(fs.stat, fs);
co(function* Ab() {
var a = yield fsReadFile(path.join(__dirname, './a.md'), 'utf-8');
var b = yield fsStat(path.join(__dirname, './b.md'));
return [a, b.size];
}).then(function (ret) {
console.log(ret);
// => [a.md' data, b.md' size]
}).catch(function (err) {
console.log(err.stack);
});