nt

nodejs-tail

Simple NodeJs implementation of tail command

Showing:

Popularity

Downloads/wk

2.2K

GitHub Stars

12

Maintenance

Last Commit

10mos ago

Contributors

3

Package

Dependencies

1

Size (min+gzip)

23.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

nodejs-tail

Simple NodeJs implementation of tail command.

Install

yarn add nodejs-tail

Syntax

new Tail(filename, options)

  • filename - file to watch
  • options - chokidar watcher options, with next values always everwritten: { alwaysStat: true, ignoreInitial: false, persistent: true, }. That is required to work similar to tail command.

Example

const Tail = require('nodejs-tail');

const filename = 'some.log';
const tail = new Tail(filename);

tail.on('line', (line) => {
  process.stdout.write(line);
})

tail.on('close', () => {
  console.log('watching stopped');
})

tail.watch();

setTimeout(() => {
  tail.close();
}, 3000);

MIT License. Copyright (c) 2017-2020 Vladimir Kuznetsov

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100