Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jokeyrhyme/promisify.js

ABANDONED: wrap a Node.js-style asynchronous function so that it returns a Promise
https://github.com/jokeyrhyme/promisify.js

Last synced: 21 days ago
JSON representation

ABANDONED: wrap a Node.js-style asynchronous function so that it returns a Promise

Awesome Lists containing this project

README

        

# promisify.js

wrap a Node.js-style asynchronous function so that it returns a Promise

[![npm module](https://img.shields.io/npm/v/@jokeyrhyme/promisify.svg)](https://www.npmjs.com/package/@jokeyrhyme/promisify)
[![Build Status](https://travis-ci.org/jokeyrhyme/promisify.js.png)](https://travis-ci.org/jokeyrhyme/promisify.js)

## ABANDONED

Use [pify](https://github.com/sindresorhus/pify) instead

## Usage

```js
const promisify = require('@jokeyrhyme/promisify');

const fs = require('fs');

const readdir = promisify(fs.readdir);

fs.readdir(process.cwd())
.then((result) => { /* ... */ })
.catch((err) => { /* ... */ });
```

## API

### `promisify (context?: Object, Function) => Promiser`

```
interface Promiser {
(...args: Any[]) => Promise
}
```

## Related

- callbackify: https://github.com/jokeyrhyme/callbackify.js