foreach-async-await
An async/await compatible method with a forEach style signature
Installation
npm i foreach-async-await
About
There may have been times where you would like to use an async function inside a forEach loop.
1 2 3 4;
As we know, the above example does not work. @async/foreach is a no frills, no dependencies module that makes iterating with async functions easier. @async/foreach takes advantage of Promise.all under the hood, so your invocations will run concurrently.
Usage
const asyncForEach = ;const fs = ; async { const files = './path/to/file1.js' './path/to/file2.js' './path/to/file3.js'; const filesContent = await ; // Prints the contents of the files read console;};