Not all at once, not one by one
Uploading 50 photos: one at a time is slow, all 50 at once overloads the network. The sweet spot is a concurrency limit — say, 3 at a time. You'll build the helper real apps use for this.
The plan
- Keep an index of the next task to start, and a results array.
- Start limit "workers". Each worker loops: take the next task, await it, store its result by index.
- When there are no tasks left, the worker stops.
- await all workers with Promise.all, then return results (in the original order).