I was wondering if it was possible to stream data from javascript to the browser's downloads manager.
Using webrtc, I stream data (from files > 1Gb) from a browser to the other. On the receiver side, I store into memory all this data (as arraybuffer ... so the data is essentially still chunks), and I would like the user to be able to download it.
Problem : Blob objects have a maximum size of about 600 Mb (depending on the browser) so I can't re-create the file from the chunks. Is there a way to stream these chunks so that the browser downloads them directly ?
var b = new Blob([new Uint8Array(500*1024*1024)], {type: 'application/octet-string'});
thoughvar b = new Blob([new Uint8Array(500*1024*1024), new Uint8Array(500*1024*1024)], {type: 'application/octet-string'});
loggedUncaught RangeError: Array buffer allocation failed
– HalftoneBlob
error was not thrown, butArray buffer allocation failed
. Asked this Question for a different purpose Where is Blob binary data stored?; eventually found the files at user filesystem where, presumably,Blob
data is stored. Another option could be to create a.zip
folder; or launch chromium with--unlimted-storage
flag would change result Though have not tried with 1GB+ as of yet. Will try code at previous comment at firefox. May require user action at settings or preferences. – Halftonevar b = new Blob([new Uint8Array(500*1024*1024), new Uint8Array(500*1024*1024)], {type: 'application/octet-string'});
didn't log any error for me, but trying to download the file usingURL.createObjectURL(b)
logged "Failed - No file" in the downloads manager ... – Bonydocument
, instead of aBlob
Method for streaming data from browser to server via HTTP, then use one of approaches posted by @LeoFarmer at How to download a file without using <a> element with download attribute or a server?. What isMIME
type of file offered for download? – Halftonechrome://blob-internals
listed 50 entries for singleBlob
created byvar b = new Blob([new Uint8Array(500*1024*1024), new Uint8Array(500*1024*1024)], {type: 'application/octet-string'});
. Is50
the current limit for number ofLength: 10,485,760
chunks allocated to oneBlob
? – Halftonedocument
tomorrow and let you know how it goes. – Bony