I have a big data file of size 8 MB. Now while my page is downloading it from the server, I would like to present a status update on how much is downloaded, e.g. 56% is downloaded. The data file in itself is a .js file!
I would like to do it from my javascript. I was thinking of the below option.
1) First measure network speed.
2) Then do a linear interpolation as I know the size of the file.
But measuring netspeed in JS is not very reliable given connection timing, caching, rendering etc etc.
Is there any direct approach, where I can straightway get the size of the partially downloaded file and calculate how much is downloaded so far.
Thanks for your help!