Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just a comment #1

Open
ghost opened this issue Oct 19, 2017 · 3 comments
Open

Just a comment #1

ghost opened this issue Oct 19, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 19, 2017

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
Copy link
Author

ghost commented Oct 19, 2017

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
Copy link
Owner

Hey!

Thanks for your comment.

I think the reason might be that node has added a promisify function in utils as shown here:
nodejs/node#12442

@ghost
Copy link
Author

ghost commented Oct 19, 2017

@merisbahti Thanks! I did not know that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant