Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReadableStream.pipeTo() function does not exist in Firefox

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?

like image 412
Dev Avatar asked Apr 15 '26 11:04

Dev


1 Answers

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.

like image 142
Okku Avatar answered Apr 18 '26 01:04

Okku



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!