Skip to content

Instantly share code, notes, and snippets.

@alanhoff
Created July 10, 2013 21:02
Show Gist options
  • Save alanhoff/5970303 to your computer and use it in GitHub Desktop.
Save alanhoff/5970303 to your computer and use it in GitHub Desktop.
var net = require('net');
var server = net.createConnection(99, 'localhost'); //modificar a porta e o host
var filePath = __dirname + '/read.json'; //caminho do arquivo a ser lido, o arquivo precisa existir
var file = require('fs').createReadStream(filePath);
server.on('connect', function(socket) {
file.pipe(server);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment