Download large file> 1GB using http protocol, java and javascript

I have a web application for downloading files. Everything works fine, except when I want to upload a file larger than 1 GB.

This is my Java code:

InputStream in = new FileInputStream(new File(folderFile.getAbsolutePath())); org.apache.commons.io.IOUtils.copy(in, response.getOutputStream()); response.flushBuffer(); in.close(); 

HTTP request:

 $http({ method:'get', url:this.apiDownloadFileUrl, responseType:'arraybuffer', cache: false }); 

and here is the client side: I received the data successfully on the client, but when I do this Blob, if the data size exceeds 500 MB, nothing happened and it was not downloaded . In addition, I can download 300MB ...

How to check if there is a memory problem or server problem? ... When I boot from gmail, I can download more than 1 GB.

  .success(function(databack) { var file = new Blob([ databack ], { type : 'application/csv' }); var fileURL = window.URL.createObjectURL(file); var a = document.createElement('a'); a.href = fileURL; a.target = '_blank'; a.download = data; document.body.appendChild(a); a.click(); 
+1
source share
1 answer

Have you tried using copyLarge () methods from IOUtils? For copy () methods, the JavaDoc says:

"For large streams, use the copyLarge method (InputStream, OutputStream).

0
source

Source: https://habr.com/ru/post/1015503/


All Articles