First get the data in blob or blob-like format and then access its size property.
Using the HTML5 Canvas API, you can do image compression on the frontend.
Let Fetch's response.blob() method do the hard work!
A Blob object is used for accessing, encoding and transferring files and file-like objects.
Any image can be copied to the clipboard with a little help from the HTML Canvas API.