Comparing version 1.2.1 to 1.2.2
@@ -24,3 +24,3 @@ // Generated by CoffeeScript 1.10.0 | ||
end: block.end - 1, | ||
encoding: "utf-8" | ||
encoding: this.encoding | ||
}); | ||
@@ -61,3 +61,3 @@ stream.on('error', (function(_this) { | ||
function Tail(filename, options) { | ||
var pos, ref, ref1, ref2, ref3, ref4; | ||
var pos, ref, ref1, ref2, ref3, ref4, ref5; | ||
this.filename = filename; | ||
@@ -68,6 +68,7 @@ if (options == null) { | ||
this.readBlock = bind(this.readBlock, this); | ||
this.separator = (ref = options.separator) != null ? ref : /[\r]{0,1}\n/, this.fsWatchOptions = (ref1 = options.fsWatchOptions) != null ? ref1 : {}, this.fromBeginning = (ref2 = options.fromBeginning) != null ? ref2 : false, this.follow = (ref3 = options.follow) != null ? ref3 : true, this.logger = options.logger, this.useWatchFile = (ref4 = options.useWatchFile) != null ? ref4 : false; | ||
this.separator = (ref = options.separator) != null ? ref : /[\r]{0,1}\n/, this.fsWatchOptions = (ref1 = options.fsWatchOptions) != null ? ref1 : {}, this.fromBeginning = (ref2 = options.fromBeginning) != null ? ref2 : false, this.follow = (ref3 = options.follow) != null ? ref3 : true, this.logger = options.logger, this.useWatchFile = (ref4 = options.useWatchFile) != null ? ref4 : false, this.encoding = (ref5 = options.encoding) != null ? ref5 : "utf-8"; | ||
if (this.logger) { | ||
this.logger.info("Tail starting..."); | ||
this.logger.info("filename: " + this.filename); | ||
this.logger.info("encoding: " + this.encoding); | ||
} | ||
@@ -74,0 +75,0 @@ this.buffer = ''; |
@@ -9,3 +9,4 @@ { | ||
"description": "tail a file in node", | ||
"version": "1.2.1", | ||
"keywords": ["tail", "file"], | ||
"version": "1.2.2", | ||
"homepage": "http://www.lucagrulla.com/node-tail", | ||
@@ -12,0 +13,0 @@ "repository": { |
@@ -48,3 +48,3 @@ #tail | ||
```javascript | ||
var options= {separator: /[\r]{0,1}\n/, fromBeginning: false, watchOptions: {}, follow: true, logger: console} | ||
var options= {separator: /[\r]{0,1}\n/, fromBeginning: false, fsWatchOptions: {}, follow: true, logger: console} | ||
new Tail(fileToTail, options) | ||
@@ -63,2 +63,3 @@ ``` | ||
* `useWatchFile`: if set to `true` will force the use of `fs.watchFile` rather than delegating to the library the choice between `fs.watch` and `fs.watchFile` (default: `false`) | ||
* `encoding`: the encoding of the file to tail (default:`utf-8`) | ||
@@ -65,0 +66,0 @@ # Emitted events |
9805
168
86