If you want to read the files in sequence, you cannot use forEach. Just use a modern for … of loop instead, in which await will work as expected:
Reading in parallel
If you want to read the files in parallel, you cannot use forEach. Each of the async callback function calls does return a promise, but you’re throwing them away instead of awaiting them. Just use map instead, and you can await the array of promises that you’ll get with Promise.all:
Another example
Problem
Solution
The forEach loop is synchronous, meaning it doesn’t wait for the inner async function to complete. This results in the data potentially being out of order when logged to the console. To fix this, you can use a for...ofloop with await: