Polymorphic rants http://www.lucagrulla.it Most recent posts at Polymorphic rants posterous.com Thu, 15 Sep 2011 12:13:00 -0700 Introducing node-tail: a NodeJS tail library http://www.lucagrulla.it/node-tail-a-nodejs-tail-library http://www.lucagrulla.it/node-tail-a-nodejs-tail-library

In the previous blog post I described the architecture of the firehose we built in Forward with NodeJS.

At the lowest level each node has to tail a log file.

Tom Hall and I couldn't find any useful cross-platform (i.e. not relying on the unix tail command) node module for that task, so I ended up writing node-tail:

Using node-tail is very simple:

1
2
3
4
5
6
7
Tail = require('tail').Tail;

tail = new Tail("fileToTail");

tail.on("line", function(data) {
  console.log(data);
});

node-tail is also available via npm, just install it with:

> npm install tail

 

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/hd2akPlb4Tfom lucagrulla lucagrulla lucagrulla