rocket-turtle-tail

0.1.0 • Public • Published

rocket-turtle-tail

Build Status js-semistandard-style Greenkeeper badge

Ever wanted to tail a file in node? Me too! Wow! Fun!

Installation

yarn add rocket-turtle-tail

or

npm install --save rocket-turtle-tail

Usage

const RocketTurtleTail = require('rocket-turtle-tail');
const tail = new RocketTurtleTail('path-to-file-you-want-to-watch');

tail.on('line', (line) => {
  console.log('OH LOOK, A LINE!', line);
});

tail.on('error', (err) => {
  console.log('Boooooo an error:', err);
});

tail.start();

Other things

The constructor takes an optional second parameter of options as follows (defaults are shown):

new RocketTurtleTail('path-to-file', {
  useWatchFile: false, // Use fs.watchFile instead of fs.watch
  interval: 5000, // Specifies the interval for useWatchFile
  fromBeginning: false // Read the file from the beginning
});

This project was inspired by node-tail. I made this repo for my own use since it couldn't do something and I don't like coffeescript enough to fix it ;)

Readme

Keywords

none

Package Sidebar

Install

npm i rocket-turtle-tail

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • grahamkennery