I know this question is answered, but I am facing issue while downloading image using Fetch API.
Code that I am using to get image.
function downloadImage() {
fetch('https://upload.wikimedia.org/wikipedia/commons/9/98/Pet_dog_fetching_sticks_in_Wales-3April2010.jpg',
{mode: 'no-cors'})
.then(response => response.blob())
.then(blob => {
console.log(blob);
});
}
Here, when I do console.log
I get response Blob {size: 0, type: ""}
.
Please let me know what I am doing wrong here?