Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

tail-file

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tail-file - npm Package Compare versions

Comparing version
1.4.15
to
1.4.16
+5
SECURITY.md
# Security Policy
## Reporting a Vulnerability
https://github.com/aigan/tail-file/issues
+1
-1
{
"name": "tail-file",
"version": "1.4.15",
"version": "1.4.16",
"description": "Tail files fast, easy, persistent, fault tolerant and flexible",

@@ -5,0 +5,0 @@ "main": "tail.js",

+25
-9

@@ -175,3 +175,4 @@ 'use strict';

if( self.force ){
self.started = self.filename;
debug("force tail of", self.filename);
this.startTail( self.filename );
}

@@ -472,2 +473,4 @@

tryTail( filename ){
//debug("tryTail", filename);
if( this.started && this.started !== filename ) this._stop();

@@ -643,3 +646,3 @@ // Might be started by findStart()

if( this.started ){
debug(`Stops tail of ${this.started}`);
debug(`stops tail of ${this.started}`);
}

@@ -675,3 +678,4 @@

if( this.fd ) return;
// debug('createReader');
//debug('createReader');
//console.warn(Error('createReader'));
this.fd = 'init';

@@ -702,9 +706,20 @@ fs.open(this.started,'r', (err,fd) =>{

//debug("Opened file as fd " + fd);
this.emit('ready', fd);
this.fd = fd;
this.readStuff();
// Get ino if not already done
if( !this.ino ) return fs.fstat( fd, (err, stats )=>{
if( err ) return onError(err);
this.ino = stats.ino;
this.onCreateReader( fd );
});
this.onCreateReader( fd );
});
}
onCreateReader(fd){
debug("Opened file as fd", fd, "ino", this.ino, "pos", this.pos);
this.emit('ready', fd);
this.fd = fd;
this.readStuff();
}
readStuff(){

@@ -796,3 +811,3 @@ if( !this.started ) return;

debug("Should we switch the streams?");
debug("Should we switch the streams?", self.backlog );

@@ -852,2 +867,3 @@ if( self.stopping ) return self.interrupt();

self.reading = false;
if( err ){

@@ -857,3 +873,3 @@ debug( 'onEndOfFileForTail stat', err );

if( stat.size ){
debug("Switching over to the new file");
debug("Switching over from", self.ino, "to the new file", stat.ino);
self._stop();

@@ -860,0 +876,0 @@ self.startPos = 'start';

@@ -614,3 +614,33 @@ 'use strict';

describe('Force start of missing file', ()=>{
let tail1;
let row1;
before( ()=>{
try{ fs.unlinkSync( filename ) } catch(err){};
try{ fs.unlinkSync( secondary ) } catch(err){};
tail1 = new Tail(filename, {force:true});
});
after( ()=> tail1.stop() );
it('reads from primary on creation', function(done){
tail1.once('line', line =>{
//debug("Recieved line " + line );
expect(line).to.eq(row1);
done();
});
tail1.on('error', err=>{
appendRow( filename ).then( row =>{
row1 = row;
});
});
tail1.start();
});
})
async function appendRow( filename ){

@@ -617,0 +647,0 @@ const nr = ++cnt;