How to quickly get remote file size
No need to fetch the actual contents in most cases. Simply make a method:'HEAD'
request, which will only query the server, and extract Content-Length
header from response.responseHeaders
.
That's it, thanks
No need to fetch the actual contents in most cases. Simply make a method:'HEAD'
request, which will only query the server, and extract Content-Length
header from response.responseHeaders
.
That's it, thanks
How to quickly get remote file size
I'm needing to evaluate online file (image) real size, since HTMLImageElement doesn't contain any relevant property about it I'm forced to make another request by GM_xmlhttpRequest({responseType='blob', ....}) and query response.size to have it. It would be acceptable if it didn't cause performance issues (browser lags unresponsive for about 5-10s for images yet around 10MB, which is too high). I guess the long episode is evaluating response.size. Is there any other method quickly resolving to how many Bs were downloaded instead of counting the buffer elements?