`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
I have a file on cloudflare pages with a size of a bit more than 5.5MB. I normally retrieve the file in chunks, but to do so, I need to know the file size.
The normal way to obtain the file size is is to do a
Unfortunately this returns
Here's the kicker, if I open another tab and enter the URL to the file to download it, the next time I try repeat the
If anyone know what's going on, my page is at https://mnm-guide.pages.dev/free
The data file is https://mnm-guide.pages.dev/madeira.pmtiles
Loading the page will fail to load the map, but if you download the file first, it will succeed.
Any way to fix this problem?
The normal way to obtain the file size is is to do a
fetch(this.url, { method: 'HEAD' }); and then retrieve the property content-length. Unfortunately this returns
-1.Here's the kicker, if I open another tab and enter the URL to the file to download it, the next time I try repeat the
fetch, the content-length is correct.If anyone know what's going on, my page is at https://mnm-guide.pages.dev/free
The data file is https://mnm-guide.pages.dev/madeira.pmtiles
Loading the page will fail to load the map, but if you download the file first, it will succeed.
Any way to fix this problem?