Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panates/putil-promisify
Simple and lightweight utility fore transforming callback functions to Promises
https://github.com/panates/putil-promisify
Last synced: about 2 months ago
JSON representation
Simple and lightweight utility fore transforming callback functions to Promises
- Host: GitHub
- URL: https://github.com/panates/putil-promisify
- Owner: panates
- License: mit
- Created: 2017-06-09T07:17:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-26T05:45:12.000Z (over 1 year ago)
- Last Synced: 2024-09-23T08:12:06.261Z (3 months ago)
- Language: JavaScript
- Size: 605 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# putil-promisify
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
[![Dependencies][dependencies-image]][dependencies-url]
[![DevDependencies][devdependencies-image]][devdependencies-url]Simple and lightweight utility fore transforming callback functions to Promises
## Installation
- `npm install putil-promisify --save`
## Usage
`promisify(resolver)`
```javascript
const Promisify = require('./');
const fs = require('fs');// Transform callback function to promise
const promise = Promisify.fromCallback((cb) => {
fs.readdir('./', cb);
});// Do what ever you want with promise
promise.then(result => {
console.log(result);
}).catch(e => {
console.error(e);
});
```## Node Compatibility
- node `>= 6.x`;
### License
[MIT](LICENSE)[npm-image]: https://img.shields.io/npm/v/putil-promisify.svg
[npm-url]: https://npmjs.org/package/putil-promisify
[travis-image]: https://img.shields.io/travis/panates/putil-promisify/master.svg
[travis-url]: https://travis-ci.org/panates/putil-promisify
[coveralls-image]: https://img.shields.io/coveralls/panates/putil-promisify/master.svg
[coveralls-url]: https://coveralls.io/r/panates/putil-promisify
[downloads-image]: https://img.shields.io/npm/dm/putil-promisify.svg
[downloads-url]: https://npmjs.org/package/putil-promisify
[gitter-image]: https://badges.gitter.im/panates/putil-promisify.svg
[gitter-url]: https://gitter.im/panates/putil-promisify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[dependencies-image]: https://david-dm.org/panates/putil-promisify/status.svg
[dependencies-url]:https://david-dm.org/panates/putil-promisify
[devdependencies-image]: https://david-dm.org/panates/putil-promisify/dev-status.svg
[devdependencies-url]:https://david-dm.org/panates/putil-promisify?type=dev
[quality-image]: http://npm.packagequality.com/shield/putil-promisify.png
[quality-url]: http://packagequality.com/#?package=putil-promisify