Skip to content

Instantly share code, notes, and snippets.

@ando-takahiro
Created August 26, 2014 09:27
Show Gist options
  • Select an option

  • Save ando-takahiro/9aa364cd0079f1ab6c8d to your computer and use it in GitHub Desktop.

Select an option

Save ando-takahiro/9aa364cd0079f1ab6c8d to your computer and use it in GitHub Desktop.
var ts = require('tail-stream');
require('http').createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
});
var stream = ts.createReadStream(req.url.substr(1), {
detectTruncate: true,
onTruncate: 'end',
endOnError: false
});
stream.pipe(res);
}).listen(8000);
@ando-takahiro
Copy link
Author

save above file as app.js
$ curl http://localhost:8000/app.js to see
$ echo "//test" >> app.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment