Skip to content

Asynchronous multithreaded file tail for node.js

Notifications You must be signed in to change notification settings

CodySchrank/FastTail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastTail

Tail a file or read from an index outside of the node.js event loop.

Install

npm install fasttail

Usage

const FastTail = require("fasttail");

const fastTail = new FastTail("test.txt");

// Tail a file from the end
fastTail.tailBlock((lines: string[], index: number) => {
    // new lines from tail
    // index of end of file line
    // Watches for changes
});

// Or read a file from a certain index (does not watch for changes)
fastTail.readFromIndex(10, (line: string) => {
    //every line after 10 (inclusive)
})

Settings

Change the poll rate fastTail.pollRate = 200

Change tail to beginning of file fastTail.tailFromBeginning = true

Notes

This is native module so it requires the node.js runtime

Uses memory mapping to quickly find index, so the entire file is loaded into memory for the first pass.

About

Asynchronous multithreaded file tail for node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published