mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
28 lines
475 B
TypeScript
28 lines
475 B
TypeScript
import { Tail } from 'tail';
|
|
|
|
const tail = new Tail('test.txt');
|
|
|
|
tail.on('line', data => {
|
|
console.log(data);
|
|
});
|
|
|
|
tail.on('error', error => {
|
|
console.log('ERROR: ', error);
|
|
});
|
|
|
|
tail.unwatch();
|
|
|
|
tail.watch();
|
|
|
|
// With options object
|
|
const tail2 = new Tail('test2.txt', {
|
|
separator: /[\r]{0,1}\n/,
|
|
fromBeginning: false,
|
|
fsWatchOptions: {},
|
|
follow: true,
|
|
logger: console,
|
|
useWatchFile: false,
|
|
encoding: 'utf-8',
|
|
flushAtEOF: false,
|
|
});
|