Skip to content

Commit

Permalink
Merge pull request #1610 from Piccirello/patch-1
Browse files Browse the repository at this point in the history
Add async/await example
  • Loading branch information
petkaantonov committed Oct 1, 2019
2 parents 6796d23 + 8e3eedc commit 933b5da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/docs/api/promise.map.md
Expand Up @@ -42,6 +42,13 @@ Promise.map(fileNames, function(fileName) {
console.log("done");
});

// Using Promise.map and async/await:
await Promise.map(fileNames, function(fileName) {
// Promise.map awaits for returned promises as well.
return fs.readFileAsync(fileName);
});
console.log("done");

```

A more involved example:
Expand Down

0 comments on commit 933b5da

Please sign in to comment.