New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tail

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tail - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

24

lib/tail.js

@@ -61,5 +61,10 @@ let events = require(`events`)

const tokens = data.split(this.separator);
const dropLastToken = (tokens[tokens.length - 1] === '') ? 1 : 0;//if the file end with empty line ignore line NL
const match = data.match(new RegExp(`(?:[^\r\n]*[\r]{0,1}\n){${tokens.length - this.nLines - dropLastToken}}`));
startingCursor = (match && match.length) ? Buffer.byteLength(match[0], this.encoding) : this.latestPosition();
const dropLastToken = (tokens[tokens.length - 1] === '') ? 1 : 0;//if the file ends with empty line ignore line NL
if (tokens.length - this.nLines - dropLastToken <= 0) {
//nLines is bigger than avaiable tokens: tail from the begin
startingCursor = 0;
} else {
const match = data.match(new RegExp(`(?:[^\r\n]*[\r]{0,1}\n){${tokens.length - this.nLines - dropLastToken}}`));
startingCursor = (match && match.length) ? Buffer.byteLength(match[0], this.encoding) : this.latestPosition();
}
} else {

@@ -188,6 +193,11 @@ startingCursor = this.latestPosition();

watchEvent(e, evtFilename) {
if (e === 'change') {
this.change();
} else if (e === 'rename') {
this.rename(evtFilename);
try {
if (e === 'change') {
this.change();
} else if (e === 'rename') {
this.rename(evtFilename);
}
} catch (err) {
this.logger.error(`watchEvent for ${this.filename} failed: ${err}`);
this.emit("error", `watchEvent for ${this.filename} failed: ${err}`);
}

@@ -194,0 +204,0 @@ }

@@ -17,3 +17,3 @@ {

],
"version": "2.2.3",
"version": "2.2.4",
"homepage": "https://www.lucagrulla.com/node-tail",

@@ -38,5 +38,5 @@ "repository": {

"chai": "4.x",
"mocha": "8.x",
"mocha": "9.x",
"nyc": "^15.1.0"
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc