Skip to content

Instantly share code, notes, and snippets.

@danvega
Created April 24, 2012 02:37
Show Gist options
  • Save danvega/2475691 to your computer and use it in GitHub Desktop.
Save danvega/2475691 to your computer and use it in GitHub Desktop.
NodeJs Tail to browser window
var http = require('http');
var spawn = require('child_process').spawn;
http.createServer(function(request,response){
response.writeHead(200,{
'Content-Type' : 'text/plain'
});
var directory = 'C:\\ColdFusion9\\logs\\';
var filename = process.argv[2];
if( filename ) {
var tail_child = spawn('powershell', ['Get-Content',directory + filename + '.log','-Wait'] );
tail_child.stdout.on('data',function(data){
console.log(data.toString());
response.write(data);
});
} else {
console.log("Please pass in the name of the log you want to read");
}
}).listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment