Thursday, 16 April 2020

Await not waiting in async function

I have this little function for deleting an image and i am trying to return a boolean to indicate whether it deleted or not to any outer async function that calls it. Perhaps I do not understand the await logic but shouldn't this function wait to execute the console.log until after the fs.unlink method is finished?​https://preview.redd.it/eo9upm4jwat41.png?width=695&format=png&auto=webp&s=4d66b2ffb9d6d2e2373e0382e3ee975e34791069The console log shows imageDeleted as undefined at all times. Can anyone help?

Submitted April 17, 2020 at 04:54AM by NoControl712

No comments:

Post a Comment