JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15923
  • Score
    100M100P100Q154366F
  • License MIT

Simple and lightweight utility for transforming callback functions to Promises

Package Exports

  • putil-promisify
  • putil-promisify/lib/promisify.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (putil-promisify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

putil-promisify

NPM Version NPM Downloads Build Status Test Coverage Dependencies DevDependencies

Simple and lightweight utility fore transforming callback functions to Promises

Installation

  • npm install putil-promisify --save

Usage

promisify(resolver)

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