Download large data stream (> 1Gb) using javascript

I was wondering if it is possible to transfer data from javascript to the browser download manager .

Using webrtc, I transfer data (from files> 1Gb) from the browser to another. On the receiver side, I store all this data in memory (like an arraybuffer ... so the data is essentially still chunks), and I would like the user to be able to load it.

Problem: Blob objects have a maximum size of about 600 MB (depending on the browser), so I cannot re-create the file from pieces. Is there any way to pass these pieces so that the browser downloads them directly?

+6
source share
1 answer

Following @ guest271314's advice, I added StreamSaver.js to my project and I successfully received files larger than 1 GB in Chrome. According to the documentation, it should work for files up to 15 GB, but my browser crashed before that (the maximum file size was about 4 GB for me).

Note I: to avoid the Blob block size limit, I also tried to manually add data to the href field for <a></a> , but it failed with files around 600 MB ...

Note II: Surprisingly createObjectURL , the basic technique using createObjectURL works fine in Firefox for files up to 4 GB !!

+1
source

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


All Articles