putil-promisify
TypeScript icon, indicating that this package has built-in type declarations

1.10.1 • Public • Published

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

/putil-promisify/

    Package Sidebar

    Install

    npm i putil-promisify

    Weekly Downloads

    36,014

    Version

    1.10.1

    License

    MIT

    Unpacked Size

    7.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • erayhanoglu