Skip to content

Instantly share code, notes, and snippets.

Created August 7, 2013 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6170854 to your computer and use it in GitHub Desktop.
Save anonymous/6170854 to your computer and use it in GitHub Desktop.
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