# event-callback-promise

> This package enable you to convert you callback function and events callbacks into promise.

Latest version **1.0.2** (published 2019-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install event-callback-promise
pnpm add event-callback-promise
yarn add event-callback-promise
bun add event-callback-promise
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-11-01 |
| First published | 2019-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Wasif Farooq |
| Maintainers | sonsor |
| Keywords | promise, callback, event promise, callback promise |

## Links

- npm: https://www.npmjs.com/package/event-callback-promise
- Repository: https://github.com/sonsor/event-callback-promise
- Homepage: https://github.com/sonsor/event-callback-promise#readme
- Issues: https://github.com/sonsor/event-callback-promise/issues
- npm.io page: https://npm.io/package/event-callback-promise

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-11-01
- 1.0.1 — 2019-11-01
- 1.0.0 — 2019-11-01

## README

### Event Callback Promise
The package enable yout to convert you callback function either its a normal function that handle callback or a event callback to promise behaviour.

## How To Install
To install run bwlow command
```bash
npm install -g event-callback-promise
```

## How To User

To convert a normal function that has a callback
```
const fs = require('fs');
const ecp = require('event-callback-promise');

// let say convert rename function of fs libarary
const rename = ecp(fs.rename);

// now call the function with params
rename('file1.tt', 'file2.txt')
    .then(() => console.log('file renamed'))
    .catch((err) => console.log("error in renaming : ", err))

```

To convert a event callback function that
```
const EventEmitter = require('events');
const ecp = require('event-callback-promise');

const emitter = new EventEmitter();
ecp(emitter, 'data')
    .then((data) => console.log('you receive : ', data))
    .catch((err) => console.log("there is a error : ", err))

emitter.emit('data', 1);

```

## License
MIT

---
_Source: https://npm.io/package/event-callback-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
