I have a list of URLs and I button to download the image.
props.image is list of urls
const Download=(props)=>{
const imageDownloadHandler= async()=>{
for(let i in props.image){
const blob = new Blob([i],{type:"application/json"});
const href = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = href;
link.download = "image"+".jpeg";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
};
return(
<button onClick={imageDownloadHandler}>Download all images</button>
)
};
images get downloaded but after opening the image locally in download it shows format not supported.
Is there any other way in react for downloading multiple images?