DEV Community

Discussion on: How to use async/await with .map in js

Collapse
 
rishadomar profile image
Rishad Omar

To expand on your file fetching example. You would use the for...of if you wanted to concatenate a set of files. For example: concatenate f1.txt f2.txt.
The sequence must then be f1.txt followed by f2.txt.
If promise.all was used and f2.txt was a small file while f1.txt was a huge file, then the concatenation would have the incorrect sequence.
PS I haven't tried this but will.

Thread Thread
 
jordandev profile image
Jordan Jaramillo

Exact!