I am trying to download large files (500mb - 2gb) using StreamSaver it works fine on Chrome but as you can see here
ReadableStream {locked: false}
locked: false
__proto__: ReadableStream
cancel: ƒ cancel()
constructor: ƒ ReadableStream()
getReader: ƒ getReader()
locked: (...)
pipeThrough: ƒ pipeThrough()
pipeTo: ƒ pipeTo()
tee: ƒ tee()
Symbol(Symbol.toStringTag): "ReadableStream"
get locked: ƒ locked()
__proto__: Object
but on Firefox:-
ReadableStream
locked: false
<prototype>: object
cancel: function cancel()
constructor: function ReadableStream()
getReader: function getReader()
locked:
tee: function tee()
<get locked()>: function locked()
<prototype>: Object { … }
as you can notice there is no pipeTo function that exists on firefox. This is my download event function
function down (event){
console.log(event.data.stream());
const stream = event.data.stream();
const fileStream = streamSaver.createWriteStream(fileNameRef.current);
if( stream.pipeTo){
stream.pipeTo(fileStream);
}
const peer = peerRef.current;
peer.write(JSON.stringify({ wait:true}));
}
Is there any way I can make it cross-browser support?
ReadableStream#pipeTo() and ReadableStream#pipeThrough() are not supported in Firefox (yet), because they require support for WriteableStreams, which Firefox does not yet support. Some polyfills are availble.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With