Guest User

Untitled

a guest
Jun 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. /**
  2. * A `tail -f` implementation in Node.js.
  3. *
  4. * Original author : Bratish Goswami <bratishgoswami AT gmail DOT com>
  5. * Modified by : Michel Bartz <michel.bartz AT manwin DOT com>
  6. *
  7. */
  8.  
  9. var sys = require("sys"),
  10. fs = require('fs'),
  11. f = "/path/to/file";
  12.  
  13. fs.watchFile(f, function(curr, prev) {
  14. fs.createReadStream(f, { start: prev.size, end: curr.size}).addListener("data", function(lines) {
  15. sys.log(lines);
  16. });
  17. });
Add Comment
Please, Sign In to add comment