# @ioredis/as-callback

> A performant and standard (Bluebird) library that registers a node-style callback on a promise

Latest version **3.0.0** (published 2022-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ioredis/as-callback
pnpm add @ioredis/as-callback
yarn add @ioredis/as-callback
bun add @ioredis/as-callback
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2022-03-19 |
| First published | 2022-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Zihua Li |
| Maintainers | ioredis-robot, luin |
| Keywords | ascallback, nodeify, promise, bluebird |

## Links

- npm: https://www.npmjs.com/package/@ioredis/as-callback
- Repository: https://github.com/ioredis/as-callback
- Homepage: https://github.com/ioredis/as-callback#readme
- Issues: https://github.com/ioredis/as-callback/issues
- npm.io page: https://npm.io/package/@ioredis/as-callback

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2022-03-19

## README

# Standard asCallback
A performant and standard (Bluebird) library that registers a node-style callback on a promise. It's used by [ioredis](https://github.com/luin/ioredis).

[![Build Status](https://github.com/ioredis/as-callback/workflows/Test/badge.svg)](https://github.com/ioredis/as-callback/actions?query=workflow%3ATest+branch%3Amaster) [![npm latest version](https://img.shields.io/npm/v/@ioredis/as-callback/latest.svg)](https://www.npmjs.com/package/@ioredis/as-callback)


## Install

```
$ npm install @ioredis/as-callback
```

## Usage

```javascript
const asCallback = require('@ioredis/as-callback').defaults;

const promise = new Promise(function (resolve) {
  setTimeout(function () {
    resolve('hello world!')
  }, 1000)
})

asCallback(promise, function callback (err, res) {
  console.log(err, res) // null, 'hello world!'
})
```

## Motivation
There are many libraries serve similar functionality. However, none of them I'd found are exactly the same as Bluebird's `asCallback` function (in terms of either performance or functionality). Thus this library comes out.

## Thanks

Most code of this library are ported from the awesome Bluebird library.

## License
The MIT License.

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