How to use socketio-file-upload - 3 common examples

To help you get started, we’ve selected a few socketio-file-upload examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SterlingButters / ip-kvm-interface / app.js View on Github external
// Start Butterfly for User
var spawn = require("child_process").spawn;
var process = spawn('butterfly.server.py',["--port=57575", "--unsecure"]);

console.log('Starting Butterfly Server on port 57575...');
process.stdout.on('data', function(chunk){
    var textChunk = chunk.toString('utf8');
    console.log(textChunk);
});

// Start WebServer
const express = require('express');
var SocketIOFileUpload = require('socketio-file-upload');
var app = express().use(express.static(__dirname + '/')).use(SocketIOFileUpload.router);

const http = require('http').Server(app);
const socket = require('socket.io')(http);

http.listen(3000, function(){
  console.log('Listening on http://127.0.0.1:3000');
});

// ------------------ upload start ------------------ //

var io = socket.listen(http);
io.sockets.on("connection", function(socket){

    // Make an instance of SocketIOFileUpload and listen on this socket:
    var uploader = new SocketIOFileUpload();
    uploader.dir = "uploads";
github cncjs / cncjs / web / lib / siofu.js View on Github external
import socket from './socket';
import SocketIOFileUpload from 'socketio-file-upload';

let siofu = new SocketIOFileUpload(socket);

// https://github.com/vote539/socketio-file-upload#instanceusetext--false
siofu.useText = true;

export default siofu;
github fossasia / open-event-wsgen / src / app.js View on Github external
const compression = require('compression');
const bodyParser = require('body-parser');
const path = require('path');
var siofu = require("socketio-file-upload");
var generator = require('./backend/generator.js');

const config = require('../config.json');

var app = express();
var server = require('http').Server(app);
var io = require('socket.io')(server);
var id = 0;


app.use(compression());
app.use(siofu.router);
var errorHandler;

io.on('connection', function(socket){
  socket.on('disconnect', function () {
  });

  id = id + 1;
  socket.connId = id;
  var uploader = new siofu();
  uploader.dir = path.join(__dirname, '..', 'uploads/connection-' + id.toString());
  socket.fileUpload = false;
  uploader.listen(socket);

  uploader.on('error', function(err) {
    console.log(err);
  });

socketio-file-upload

Uploads files to a Node.JS server using Socket.IO

X11
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis

Popular socketio-file-upload functions