Can I upload a file to server by socket.io in node.js?

后端 未结 5 1294
情歌与酒
情歌与酒 2020-12-07 18:02

I have a socket.io client to whom socket.io server is listening in node.js. I want to upload a file to server by socket.io. be

相关标签:
5条回答
  • 2020-12-07 18:10

    Here is an example of sending a file over socket.io: http://liamkaufman.com/blog/2012/02/11/12-pushing-files-to-the-browser-using-deliveryjs-socketio-and-nodejs/

    0 讨论(0)
  • 2020-12-07 18:13

    The checked answer is invalid as of Jul 3rd 2012.

    Read by yourself this tutorial on NetTuts. This tutorial uses node.js and socket.io to upload a file.

    0 讨论(0)
  • 2020-12-07 18:18

    I wrote a module for this purpose.

    socket.io-stream

    0 讨论(0)
  • 2020-12-07 18:29

    In May of 2014 with release version 1.0 of socket.IO, binary support has been added to the library.

    Socket.IO now supports emitting Buffer (from Node.JS), Blob, ArrayBuffer and even File, as part of any datastructure

    It's all due to low level api which is provided by engine.io.

    0 讨论(0)
  • 2020-12-07 18:36

    Here is a npm module I wrote that will implement Socket.IO file uploading in your application:

    Socket.IO File Upload

    All you need to give the module is your middleware, your socket, and the file input or drop zone used for uploading files. It will also save the files if you give it a directory. The module takes care of the rest.

    0 讨论(0)
提交回复
热议问题