diff options
| author | Kumar Priyansh <[email protected]> | 2019-01-19 12:37:14 +0530 |
|---|---|---|
| committer | Kumar Priyansh <[email protected]> | 2019-01-19 12:37:14 +0530 |
| commit | dcdfc94cb39dfe2c39925a0145ffa45e2d061c30 (patch) | |
| tree | 4f6379d955555b298c0e7b83a67e264240ee5614 /cordova/node_modules/tail/README.md | |
| parent | 76f7b3678d3f1ff99c3935a774d420453b0c3cb9 (diff) | |
| download | WeatherApp-dcdfc94cb39dfe2c39925a0145ffa45e2d061c30.tar.xz WeatherApp-dcdfc94cb39dfe2c39925a0145ffa45e2d061c30.zip | |
Initial Upload via GIT
Diffstat (limited to 'cordova/node_modules/tail/README.md')
| -rwxr-xr-x | cordova/node_modules/tail/README.md | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/cordova/node_modules/tail/README.md b/cordova/node_modules/tail/README.md new file mode 100755 index 0000000..eec282c --- /dev/null +++ b/cordova/node_modules/tail/README.md @@ -0,0 +1,72 @@ +#tail + +To install: + +```bash +npm install tail +``` + +#Use: +```javascript +Tail = require('tail').Tail; + +tail = new Tail("fileToTail"); + +tail.on("line", function(data) { + console.log(data); +}); + +tail.on("error", function(error) { + console.log('ERROR: ', error); +}); +```` + +Tail constructor accepts few parameters: + +```javascript + +var fileToTail = "/path/to/fileToTail.txt"; +var lineSeparator= "\n"; +var fromBeginning = false; +var watchOptions = {}; \\ as per node fs.watch documentations + +new Tail(fileToTail, lineSeparator, watchOptions,fromBeginning) +``` + +* `fileToTail` is the name (inclusive of the path) of the file to tail +* `lineSeparator` is the line separator token (default "\n") +* `watchOptions` is the full set of options that can be passed to `fs.watch` as per node documentation (default: {}) +* `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") + +The only mandatory one is the first, i.e. the the file you want to tail. + +Tail emits two type of events: + +* line +``` +function(data){} +``` +* error +``` +function(exception){} +``` + +If you simply want to stop the tail: + +```javascript +tail.unwatch() +``` + +And to start watching again: +```javascript +tail.watch() +``` + +#Want to fork ? + +Tail is written in [CoffeeScript](http://jashkenas.github.com/coffee-script/). + +The Cakefile generates the javascript that is then published to npm. + +#License +MIT. Please see License file for more details. |
