Answer the question
In order to leave comments, you need to log in
How to write code synchronously?
Good afternoon, I understand that there is a lot of information on the Internet on this topic. I honestly tried to figure it out myself, but maybe today is a bad day and I can’t figure out how to combine synchronous code in nodejs and asynchronous code.
There are functions
a()
b()
c()
Three functions access the api, get data and write data using fs.writeFileSync
I need these three functions to work asynchronously, and then after they execute the
start() function
How do I block stream and wait for these functions to work
Answer the question
In order to leave comments, you need to log in
Make functions a, b, c asynchronous (use writeFile from fs/promises)
await Promise.all([a(), b(), c()]);
start();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question