I upload a png image on my website (localhost). The blob is this -
size: 81503
type: "image/png"
__proto__: Blob
arrayBuffer: ƒ arrayBuffer()
size: (...)
slice: ƒ slice()
stream: ƒ stream()
text: ƒ text()
type: (...)
constructor: ƒ Blob()
Symbol(Symbol.toStringTag): "Blob"
get size: ƒ size()
get type: ƒ type()
__proto__: Object
When I do URL.createObjectURL(blob) and set filename as xyz.jpeg, I get the correct image file, which is loading in ImageViewer but the file type is wrong.
But when I set filename as xyz.png, file is being downloaded, ImageViewer shows Fatal error reading PNG image file: Not a PNG file.
Why is that? Clearly the blob has file.type png as shown above. So, why is downloading blob as png throwing error?