Geeek
Geeek

Reputation: 175

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

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>

Upvotes: 1

Views: 233

Answers (0)

Related Questions