Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

File is Incorrectly Typed as File #186

Closed vantaboard closed 1 year ago

vantaboard commented 1 year ago

I believe the return is typed incorrectly.

Upon logging, you can see it is referred to as a Blob. It has all of the correct properties, but at some point during this transaction, it drops type, and I kept getting errors related to type being undefined despite it being in there as a property. Once I began treating is a Blob without the properties of my File it worked. I'm wondering what this is caused by. image

Donaldcwl commented 1 year ago

It has intentionally been changed to "Blob" due to compatibility with browsers.

Details in: https://github.com/Donaldcwl/browser-image-compression/blob/d933bc8e483a9853ed2b57338e035e8c45e40dc7/lib/utils.js#L22