thenify-all

Promisifies all the selected functions in an object

MIT 9 个版本
安装
npm install thenify-all
yarn add thenify-all
pnpm add thenify-all
bun add thenify-all
README

thenify-all

NPM version Build status Test coverage Dependency Status License Downloads Gittip

Promisifies all the selected functions in an object.

var thenifyAll = require('thenify-all');

var fs = thenifyAll(require('fs'), {}, [
  'readFile',
  'writeFile',
]);

fs.readFile(__filename).then(function (buffer) {
  console.log(buffer.toString());
});

API

var obj = thenifyAll(source, [obj], [methods])

Promisifies all the selected functions in an object.

  • source - the source object for the async functions
  • obj - the destination to set all the promisified methods
  • methods - an array of method names of source

var obj = thenifyAll.withCallback(source, [obj], [methods])

Promisifies all the selected functions in an object and backward compatible with callback.

  • source - the source object for the async functions
  • obj - the destination to set all the promisified methods
  • methods - an array of method names of source

thenifyAll.thenify

Exports thenify this package uses.

版本列表
1.6.0 2015-01-10
1.5.1 2015-01-08
1.5.0 2015-01-08
1.4.0 2014-12-27
1.3.0 2014-12-25
1.2.0 2014-12-25
1.1.0 2014-12-19
1.0.0 2014-12-17
0.0.0 2014-12-17