Comparing version 0.3.7 to 0.3.8
@@ -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 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6062
129
73
1