Node.js · Junior · Question 35 of 75

How do you get a promise-based version of the fs API?

Explanation

fs/promises has the same functions that return promises, so you can write const text = await readFile(path, "utf8").

Further reading

Problem with a question

Node.js · Junior · question 35

Test yourself

Take the Node.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz