po

4.5.2 • Public • Published

po = promiseify + co

NPM version Build status Test coverage

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);
});

Dependents (1)

Package Sidebar

Install

npm i po

Weekly Downloads

14

Version

4.5.2

License

none

Last publish

Collaborators

  • cloudcome