Created
August 7, 2013 03:09
-
-
Save anonymous/6170854 to your computer and use it in GitHub Desktop.
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 crypt = require('crypto'); | |
var fs = require('fs'); | |
var Opj_Ssfrc = require('./Opj_Ssfrc'); | |
fs.readFile('150MB_file.exe', function (err,data) { | |
client = net.connect({host:this.host, port:this.port}); | |
var header = { | |
sentdate: new Date(), | |
filename: fn, | |
filesize: data.length, | |
checksum: crypt.createHash('md5').update(data).digest('base64'), | |
}; | |
// first i send header | |
client.write(JSON.stringify(header)); | |
// then i send data buffer | |
// Sending success If filesize still in KB or less than 20MB | |
client.write(data); | |
// And i want a technique like fs.createReadStream(_this.locationPath+_this.header.filename).pipe(client); | |
// but come from buffer directly.. hmmm something like coolMethod(myExistingBuffer).pipe(client); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment