Send file from server to client (browser) through socket io using socket.io-stream node package

213 views Asked by At

I am trying to receive a file from the socket io server using socket.io-stream package. I receive a stream but how do I download that stream in a file. The file could be any format. Is there a way to do it as browser js does not have fs package. I was reading there could be a blob but not sure how to do it.

<script>
      $(function () {
        var socket = io();

        ss(socket).on('file', function(stream, data) {
          **//stream.pipe(fs.createWriteStream(filename));**
         });

      });
    </script>
0

There are 0 answers