Convert callback to promise
Compatible with Node.js >= 6
$ npm i -S lagden-promisify
Compatible with Node.js >= 5
$ npm i -S lagden-promisify@2.0.0
Compatible with Node.js >= 4
$ npm i -S lagden-promisify@1.0.2
const promisify = require('lagden-promisify');
const fs = require('fs');
const readfile = promisify(fs.readFile);
readfile('./sample.txt')
.then(data => console.log);
.catch(err => console.log);
MIT © Thiago Lagden