wanted to implement a 3 s delay in downloading each image, but did not find out the reason why await did not take effect. The code is as follows
axios.get(imgSrc, {
responseType: "stream"
}).then(async res => {
console.log("")
await pipeSync(res,dirName,type)
currentNumberPP;
console.log(currentNumber);
});
function pipeSync(res,dirName,type){
return new Promise(function (resolve, reject) {
res.data.pipe(fs.createWriteStream(dirName + "/" + (new Date().getTime())+"."+type));
setTimeout(resolve,3000);
});
}