ReadableStream.pipeTo() function does not exist in Firefox

Viewed 838

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?

1 Answers
Related