0

I'm writing a program that consists of two Node servers (well, one of them's an Electron application) that are connected with Socket.io, and i'm looking for a way to send a large file (up to 10gb) from the socket server to the socket client over the socket connection. It must be over the socket connection because the client (the Electron application) cannot be at a guaranteed IP address, and therefore cannot be contacted independently.

The problem is that all of the frameworks I can find for sending large files over Socket connections are designed for sending files from the client to the server, not the other way around.

Does anyone have any ideas on how I could do this? Are there any frameworks that can break files into chunks as to not overload memory AND is able to send files from the server to the client? If not, what will making one entail?

Thanks.

Sam54123
  • 13
  • 1
  • 2
  • Does [this question](https://stackoverflow.com/questions/40382840/how-to-send-large-file-using-sockets) help? You'll want to utilize node's streams so that you can just pipe the file stream into the socket stream on the server and vice versa on the client. – cbr Feb 02 '20 at 01:05
  • 1
    Does this answer your question? [How to send large file using sockets?](https://stackoverflow.com/questions/40382840/how-to-send-large-file-using-sockets) – Nguyễn Văn Phong Feb 02 '20 at 02:03
  • Perhaps [socket.io-file](https://www.npmjs.com/package/socket.io-file). – jfriend00 Feb 02 '20 at 04:01
  • @cubrr That worked! If this was an answer instead of a comment, I would mark it as the accepted answer. Thanks! – Sam54123 Feb 03 '20 at 04:10

0 Answers0