Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * A `tail -f` implementation in Node.js.
- *
- * Original author : Bratish Goswami <bratishgoswami AT gmail DOT com>
- * Modified by : Michel Bartz <michel.bartz AT manwin DOT com>
- *
- */
- var sys = require("sys"),
- fs = require('fs'),
- f = "/path/to/file";
- fs.watchFile(f, function(curr, prev) {
- fs.createReadStream(f, { start: prev.size, end: curr.size}).addListener("data", function(lines) {
- sys.log(lines);
- });
- });
Add Comment
Please, Sign In to add comment