for (const item of array) {
await processImage(image, name)
}
Внутри цикла не работает setTimeout
const wait = time => new Promise(r => setTimeout(r, time));
(async () => {
for (const n of [ 1, 2, 3, 4, 5 ]) {
console.log(n);
await wait(1000);
}
})();
[ 1, 2, 3, 4, 5 ].reduce((promise, n) => promise
.then(() => console.log(n))
.then(() => wait(1000))
, Promise.resolve());