npm.io
0.0.3 • Published 10 years ago

nodecb2promise

Licence
MIT
Version
0.0.3
Deps
0
Vulns
0
Weekly
0
Stars
1

nodeCB2promise

Small helper to wrap a node(-like) callback function into a ES6 promise

Sample:

const wrapFn = require("nodecb2promise");

const fr = wrapFn(require('fs').readFile);

fr('package.json')
   .then(file => console.log(file.toString()))

This module exists primarly to avoid adding 3rth party resouces for a few calls where I just need a simple conversion from callbacks to promises.

needs: node 6+