Conversation
I seriously doubt that, because it simple calls some high level js functions. I don't like the approach where both callbacks and promises could be used. I think there should be separate set of functions that return promises. |
I would prefer it over this situation: |
|
Given that promises exemplify the future of async in ES6/7 javascript, we should be looking to the future as having those default returns on async functions IMO. (where it makes sense) |
lib/fs.js
Outdated
There was a problem hiding this comment.
maybe switch to typeof callback === 'function'?
|
This is interesting, but I'm going to close it out for further discussion on NG as per #11 (comment), and that there isn't momentum at this time. This is a great reference for future discussions though, thanks for making it! |
Alternate approach to promisification done by @bajtos in #173
I added more direct support for promise-like fulfill/reject in req_wrap, in the hopes it would be faster if support went deeper into C++.
The benchmarks are noisy on the machines I have access to, but it AFAICT, performance is no better or worse than node, for callback case. Also, no better or worse than #173 for the Promise case.
.
There are some open questions about whether direct use of a v8::Promise:Resolver object could be faster, but I'm blocked on that because I can't create one with any slots, so
Wrap()can't work on it.I'm also interested to look at bluebird, which at least one commentator claimed was faster than #173 when it promisifies fs. If so, it should be possible to improve the promise path in pure js.