Closed desaikalpesh34 closed 4 years ago
Same here. imageCompression is always returning a blob
@desaikalpesh34 @edsonfeimberg
If you want a File from a Blob, can simply do this:
const blob = await imageCompression(file, options)
const file = new File([compressedFile], "compressed.png")
For better browser compatibility, I decided to use Blob instead of File. e.g. Safari has an issue with File constructor not being able to POST in FormData e.g. Edge (Original) does not support File constructor see more in: https://github.com/Donaldcwl/browser-image-compression/blob/9fcc363eeec63c7ff044144cf98d5bb3a408201a/lib/utils.js#L55-L83
If you really need a File object for some reason, you can see the suggestion from @jiangyijie27.
How to return File object.
i need this file as File Object