Skip to content

Commit

Permalink
Add async/await example
Browse files Browse the repository at this point in the history
  • Loading branch information
Piccirello authored Sep 26, 2019
1 parent 6796d23 commit 8e3eedc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/docs/api/promise.map.md
Original file line number Diff line number Diff line change
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 8e3eedc

Please sign in to comment.