Skip to content

Commit 8e3eedc

Browse files
authoredSep 26, 2019
Add async/await example
1 parent 6796d23 commit 8e3eedc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎docs/docs/api/promise.map.md

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ Promise.map(fileNames, function(fileName) {
4242
console.log("done");
4343
});
4444

45+
// Using Promise.map and async/await:
46+
await Promise.map(fileNames, function(fileName) {
47+
// Promise.map awaits for returned promises as well.
48+
return fs.readFileAsync(fileName);
49+
});
50+
console.log("done");
51+
4552
```
4653

4754
A more involved example:

0 commit comments

Comments
 (0)
Please sign in to comment.