title: Nodejs - Stream output to browser
body: <pre><code>var http = require("http");
  var sys = require('sys')
  var filename = process.ARGV[2];
  var exec = require('child_process').exec;
  var com = exec('uptime');
  
  
  http.createServer(function(req,res){
    res.writeHead(200,{"Content-Type": "text/plain"});
    com.on("output", function (data) {
      res.write(data, encoding='utf8');
    });  
  }).listen(8000);
  sys.puts('Node server running')
  </code></pre>
  
  <p>How do I get the data streamed to the browser ?</p>