nodejs-tail

1.1.1 • Public • Published

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 hard coded next values: { alwaysStat: true, ignoreInitial: false, persistent: true, }

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

Readme

Keywords

Package Sidebar

Install

npm i nodejs-tail

Weekly Downloads

68

Version

1.1.1

License

MIT

Unpacked Size

6.07 kB

Total Files

5

Last publish

Collaborators

  • vladimir-kazan