Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knpwrs/any-pify
A wrapper to use pify with any-promise.
https://github.com/knpwrs/any-pify
Last synced: 1 day ago
JSON representation
A wrapper to use pify with any-promise.
- Host: GitHub
- URL: https://github.com/knpwrs/any-pify
- Owner: knpwrs
- License: mit
- Created: 2016-09-13T23:42:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-05T07:59:49.000Z (about 7 years ago)
- Last Synced: 2024-10-31T17:19:21.009Z (14 days ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# any-pify
[![Greenkeeper badge](https://badges.greenkeeper.io/knpwrs/any-pify.svg)](https://greenkeeper.io/)
Simply [`pify`] pre-loaded with [`any-promise`].
## Usage
```js
const pify = require('any-pify');
const fs = require('fs');// Promisify a single function
pify(fs.readFile)('package.json', 'utf8').then(data => {
console.log(JSON.parse(data).name);
});// Or promisify all methods in a module
pify(fs).readFile('package.json', 'utf8').then(data => {
console.log(JSON.parse(data).name);
});
```## API
### `pify(input, [options])`
Returns a promise wrapped version of the supplied function or module.
The [`promiseModule`] option from [`pify`] is not present here. It is passed
the value resolved from [`any-promise`]. The [`options`] argument is passed
directly to [`pify`].## License
**MIT**
[`any-promise`]: https://github.com/kevinbeaty/any-promise "any-promise"
[`options`]: https://github.com/sindresorhus/pify#options "pify options"
[`pify`]: https://github.com/sindresorhus/pify "pify"
[`promiseModule`]: https://github.com/sindresorhus/pify#promisemodule "pify promiseModule"