This package has been deprecated

Author message:

Deprecated in favor of node() and ncall() functions of q package

q-wrap

0.0.1 • Public • Published

q-wrap

Utility library to wrap async functions with last callback argument to promise returning functions.

Usage

Convert callback-based function

var convert = require('q-wrap').convert,
    fs = require('fs'),
 
    readFile = convert(fs.readFile);
 
readFile('test.txt')
    .then(function(content) {
        console.log(content);
    })
    .fail(function(err) {
        console.error('Error opening file: %s', err);
    })

Execute callback-based function

var execute = require('q-wrap').execute,
    fs = require('fs');
 
execute(fs.readFile, 'test.txt')
    .then(function(content) {
        console.log(content);
    })
    .fail(function(err) {
        console.error('Error opening file: %s', err);
    })

Readme

Keywords

none

Package Sidebar

Install

npm i q-wrap

Weekly Downloads

12

Version

0.0.1

License

none

Last publish

Collaborators

  • arikon