Bug 1355978 Comment 29 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Doing a XHR Range Request on a local large files (using 50GB wikipedia dumps) takes forever to return. Firefox appears to search for the end of the file before returning a response. 

A couple weeks back, it would try to read the entire file into memory and the browser would hang. It now looks like it's not doing that, but it is still probably searching for the end of file given the amount of time it takes to return. 

My code just needs the file meta data in the header (first 80 bytes) of these files. And it uses a basic XHR function below to get it. This works on Chrome instantly. 

function read(bytestart, byteend, oncomplete){	
	var req = new XMLHttpRequest();
	req.addEventListener("load", oncomplete);
	req.open('GET', params["archive"], true); 
	req.overrideMimeType('text\/plain; charset=x-user-defined');
	req.responseType = "arraybuffer";
	req.setRequestHeader('Range', 'bytes='+bytestart+'-'+byteend);
	try {
	  req.send(null);
	} catch (ex) {
  		console.log(ex);
	}	
}
https://bit.ly/3HFIRqq

Back to Bug 1355978 Comment 29