0.1.1 • Published 10 years ago
node-style-promisify v0.1.1
Installation
$ npm i node-style-promisify
node-style-promisify@0.1.1 node_modules/node-style-promisify
$ Example
import fs from 'fs';
import promisify from 'node-style-promisify';
const readFile = promisify(fs, fs.readFile);
readFile('file.txt', 'utf8').then(([ data ]) => {
process.stdout.write(data);
}).catch(error => {
console.error(error.toString());
});API
promisify(thisArg, func)
thisArgThe value ofthisto be passed tofuncwhen it is calledfuncThe function to call via the wrapper
Returns a wrapper around func that returns a Promise object when called.