This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var io = require('socket.io').listen(8081); | |
var parser = require('socket.io').parser; | |
io.sockets.on('connection', function(socket) { | |
var pre; | |
var i = 0; | |
io.transports[socket.id].parser.on('data', function(p) { | |
var packet = parser.decodePacket(p); | |
if(packet.type === 'heartbeat') { | |
if(global.gc) global.gc(); | |
var memoryUsage = process.memoryUsage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var http = require('http'); | |
var util = require('util'); | |
var file = './1G.file'; | |
var stat = fs.statSync(file); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'octet-stream/binary', | |
'Content-Length': stat.size | |
}); | |
var rStream = fs.createReadStream(file); |