Huge News!Announcing our $40M Series B led by Abstract Ventures.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 0.3.7 to 0.3.8

2

package.json

@@ -6,3 +6,3 @@ {

"description": "tail a file in node",
"version": "0.3.7",
"version": "0.3.8",
"repository": {

@@ -9,0 +9,0 @@ "type": "git",

@@ -24,14 +24,24 @@ #tail

Tail accepts the line separator as second parameter. If nothing is passed it is defaulted to new line '\n'.
Tail constructor accepts few parameters:
```javascript
var lineSeparator= "-";
var fileToTail = "/path/to/fileToTail.txt";
var lineSeparator= "\n";
var fromBeginning = false;
var watchOptions = {}; \\ as per node fs.watch documentations
new Tail("fileToTail",lineSeparator)
new Tail(fileToTail, lineSeparator, fromBeginning, watchoptions)
```
* `fileToTail` is the name (inclusive of the path) of the file to tail
* `lineSeparator` is the line separator token (default "\n")
* `fromBeginning` force the tail of the file from the very beginning of it instead of from the first new line that will be appended(default: "\n")
* `watchOptions` is the full set of options that can be passed to `fs.watch` as per node documentation (default: {})
The only mandatory one is the first, i.e. the the file you want to tail.
Tail emits two type of events:
* line
* line
```

@@ -38,0 +48,0 @@ function(data){}

@@ -54,3 +54,3 @@ // Generated by CoffeeScript 1.6.2

function Tail(filename, separator, fsWatchOptions) {
function Tail(filename, separator, frombeginning, fsWatchOptions) {
var stats,

@@ -61,2 +61,3 @@ _this = this;

this.separator = separator != null ? separator : '\n';
this.frombeginning = frombeginning != null ? frombeginning : false;
this.fsWatchOptions = fsWatchOptions != null ? fsWatchOptions : {};

@@ -69,6 +70,6 @@ this.readBlock = __bind(this.readBlock, this);

stats = fs.statSync(this.filename);
this.pos = stats.size;
this.internalDispatcher.on('next', function() {
return _this.readBlock();
});
this.pos = this.frombeginning ? 0 : stats.size;
this.watch();

@@ -75,0 +76,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