promise-cb
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Promise-CB

Promise-callback helper functions.

fromCallback

Creates a Promise from a callback-style function.

Example:

fromCallback(cb => fs.readFile(file, cb));

toCallback

Calls a callback function with the result of a promise once it settles.

Example:

toCallback(promise, (err, result) => {
  if (err) console.error(err.stack);
  else doSomething(result);
});

Readme

Keywords

none

Package Sidebar

Install

npm i promise-cb

Weekly Downloads

269

Version

0.1.4

License

ISC

Last publish

Collaborators

  • gileze33
  • louy