es6-denodeify
Convert callbacks to promises.
Last updated 11 years ago by valeriangalliat .
Unlicense · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install es6-denodeify 
SYNC missed versions from official npm registry.

es6-denodeify npm version

Convert callbacks to promises.

Why?

There's already a lot of modules in npm registry to convert callbacks to promises. Why another?

All the modules I found for this purpuse were either depending on some specific promise implementation, or expecting a global Promise constructor. I needed a module that allowed me to inject the promise implementation I'm using. And I found it, it is called promise-denodeify, but since a few weeks it's marked as deprecated, without any recommended alternative solution, and it displays a warning during npm installs when you depend on it, which makes people freak out.

I already tweeted a really simple denodeify implementation, leveraging ES6 arrow functions, and I like it in its brevity. I'm now publishing it as a npm package.

Usage

const denodeify = require('es6-denodeify')(Promise)
const fs = require('fs')
const readFile = denodeify(fs.readFile)

readFile('package.json', 'utf8').then(console.log)

If you have a global Promise constructor and you want es6-denodeify to use it, you can ommit the explicit Promise injection.

const denodeify = require('es6-denodeify')()

Current Tags

  • 0.1.5                                ...           latest (11 years ago)

6 Versions

  • 0.1.5                                ...           11 years ago
  • 0.1.4                                ...           11 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 5
Last Month 6
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |