Need to query downloading of file array
I have an array with URL's of files to dowload:
const arrUrl = [
'http://server.domain/path/file1.jpg',
'http://server.domain/path/file2.jpg',
'http://server.domain/path/file3.jpg',
];
when i try to download files with Axios and code:
arrUrl.forEach(async (element: string, i:number) => {
const response = await new Axios({responseType: 'stream'}).get(element);
await writeFile('./files/'+i, response.data);
console.log(element);
});
All files start downloading at one time. But how can i download files in query mode? one-by-one