Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add async/await example
  • Loading branch information
Piccirello committed 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
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.