The callback-hell times are long over. We have better tools now. But which of the new kids on the block do you want to play with? In this meetup, last night we tried out async functions, also known by the name "async/await". It was a fun learning experience. Keep reading and get inspired.
Tagged with #async
fs.exists since this does not play by the rules of node style callback params,
where the first one should be err and then data. It seems this does return only the data, which
promisify understands as an error and does throw right away. Instead do what the
node js docs suggest
too and use
fs.access instead, like so:
See it in action [here in the cosmowiki].