I'm making a internet speedtest app with Node.js. Everything works fine expect the download test. I normally download at 8Mbits/s but when I try XHR requesting a text file / image (about 256 MByte) at /public/chunk/somefile.txt for example, it downloads it within 1 second which is impossible. Then I checked the onprogress log:
How comes that it loads the image so fast? I mean it isnt cached or anything. Anyways here's the code:
const fileUrl= "/public/chunk/d.jpg";
xhr = new XMLHttpRequest();
xhr.onprogress = (e) => console.log(e, e.loaded - e.total);
xhr.onloadend = () => { console.log("end")};
xhr.open("GET", fileUrl, true);
xhr.setRequestHeader('Cache-Control','no-cache');
xhr.send();
BUT: Here's the thing, if I put in a image url for example: https://upload.wikimedia.org/wikipedia/commons/f/ff/Pizigani_1367_Chart_10MB.jpg . It works! Why?
Please let me know why it doesn't work, I've been trying around since 5 hours now. Thanks in advance.