$ npm install node.tail
new Tail(target, options);
var Tail = require('node.tail');
var tailFile = new Tail('fileName.log',{follow: true, lines: 20});
tailFile.on('line', console.log);
tailFile.on('error', console.error);
Optional. Default values:
{
buffer: 63 * 1024 - 1, //max value
sep: '\n', //Line separator
lines: 10, //how much lines show from end (tail -n 10)
follow: false, //(tail -F)
sleep: 500 //how often the target should be polled in ms(tail -s 0.5)
}
- line String next line from the target
- error Error object