Tuesday 21 May 2019

Help me to run the code line by line, not async way

I'm having a trouble to run my javascript code line by line. In my route function, I'm using a library to get an info of the given pdf file. Here is my snippet of code.​const res = pdfUtil.info(filePath, function(err, info) { if (err) throw(err); return info }) console.log(res) // prints nothing since the above line runs in async way ​Should I use async/await method to achieve this? Or is there a simpler way?

Submitted May 21, 2019 at 09:25PM by leetae9

No comments:

Post a Comment