I am trying to download a file using ajax call. I need to use ajax call because I have to make a post request along with that I need to send some headers from the client. As Server API is not under our control, we dont have much choice other than using AJAX. In order to show file save dialog, I am converting the byte array to blob to Object URL like shown below
var oReq = new XMLHttpRequest();
oReq.open("POST","api/operations/zip", true);
oReq.responseType = "arraybuffer";
oReq.onload = function(oEvent) {
var blob=new Blob([oReq.response], {type: 'application/octet-binary'});
var link=document.createElement('a');
link.href=window.URL.createObjectURL(blob);
link.download="myFileName.zip"; link.click();
}
oReq.send(filePaths);
Now i would like to know is there any limit on Blob size we can have in javascript other than browser memory constraint. like is it possible to download 4 GB file if I have around 8 GB RAM.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire