Can I use the HTTP range header to load partial files "on purpose"?


I’m playing around with the HTTP range header (specs).

From what I understand I can set byte ranges of files ala


Say I only want to access certain ranges of a file, would it be possible to specify these ranges and then work with the “incomplete” data I received? I’m playing around with filtering a large log file, so I’m curious if something like this would work.

Thanks for inputs!


You are right, the link which you posted in the comment would be probably the best approach. As your question sounded interesting i tried it out. You probably did it, but here is an snippet (for other, that may come looking)

var xmlhttp=new XMLHttpRequest();"GET","data.dat",false);
xmlhttp.setRequestHeader("Range", "bytes=100-200");
xmlhttp.send();; //--> returns only the partial content
// Tested on Win7 with chrome 46+

Watch-out: the web-server has to support this Request Header Range, for this to work.

Answered By – winner_joiner

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.