merisbahti / promiser.js

Creates a native ES6 Promise from a function which takes a node style Error-First callback.
ISC License
2 stars 0 forks source link

Just a comment #1

Open ghost opened 7 years ago

ghost commented 7 years ago

What is really nice that you can wrap entire modules with it and you can use ES7 async functions. e.g.

const fs =  wrap(require('fs'));

(async function (){
    try {
        var content = await fs.readFile('test.js', 'utf8');
        console.log(content);
    } catch(e) {
        console.error(e);
    }
})();

I was wondering why so few stars you get. Maybe there is another lib with the same features or node modules were already converted so they don't need to be wrapped? I did not check yet.

ghost commented 7 years ago

Yepp, there are libs which does the same but they are module specific, e.g. https://www.npmjs.com/package/async-file They are checking whether there is a callback present and if no, then they generate it... I think it is relative easy to add new features to this lib. I already created my own ES5 compatible version of it. Maybe I'll develop it further and publish it, idk. yet, I already have too many projects.

merisbahti commented 7 years ago

Hey!

Thanks for your comment.

I think the reason might be that node has added a promisify function in utils as shown here: https://github.com/nodejs/node/pull/12442

ghost commented 7 years ago

@merisbahti Thanks! I did not know that.