nano-promisify
v1.1.0
Published
A minimal promisifying callback-based function(s) module
Downloads
2,437
Readme
nano-promisify
Promisify callback-based function(s)
Usage
Converting a function
var promisify = require('nano-promisify');
var readFile = promisify(fs.readFile);
readFile('./indes.js', 'utf8')
.then(function (text) {
console.log(text);
})
.catch(function (e) {
console.error(e);
});
Converting a library
Only callback functions will be wrapped.
var promisify = require('nano-promisify');
var fs = promisify(fs);
fs.readFile('./indes.js', 'utf8')
.then(function (text) {
console.log(text);
})
.catch(function (e) {
console.error(e);
});