Skip to content

Simple and lightweight utility fore transforming callback functions to Promises

License

Notifications You must be signed in to change notification settings

panates/putil-promisify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple and lightweight utility fore transforming callback functions to Promises

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published