5 ms·
Agreed! There is a handy package called `denodeify` which converts the callback pattern (with err) to promises. It works for every async function in node, exce
by evv 10y ago
Agreed! There is a handy package called `denodeify` which converts the callback pattern (with err) to promises.
It works for every async function in node, except for `fs.exists` which inexplicably does not provide an error in the callback.
Speaking of which, when is node going to actually start supporting promises natively? I've been using this denodeify hack for years!
- franciscop 10y agoI would say there are dozens of projects that do this from a search I did a while back.