@cfware/promisify-proxydeprecated

ES6 Proxy object for promisifying selected members of an object.

Usage no npm install needed!

<script type="module">
  import cfwarePromisifyProxy from 'https://cdn.skypack.dev/@cfware/promisify-proxy';
</script>

README

@cfware/promisify-proxy

Travis CI NPM Version NPM Downloads MIT

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