@cfware/promisify-proxy
ES6 Proxy object for promisifying selected members of an object.
Install @cfware/promisify-proxy
npm i --save @cfware/promisify-proxy
Usage
'use strict';
const promisifyProxy = require('@cfware/promisify-proxy');
const fs = promisifyProxy(require('fs'), ['stat']);
/* stat gets promisified. */
fs.stat('filename.txt')
.then(console.log)
.catch(console.error);
/* access does not get promisified. */
fs.access('filename.txt', err => {
if (err) {
console.error(err);
} else {
console.log('fs.access successful.');
}
});
Running tests
Tests are provided by eslint and mocha.
npm install
npm test