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 1.0.1 to 1.1.0

2

package.json

@@ -9,3 +9,3 @@ {

"description": "tail a file in node",
"version": "1.0.1",
"version": "1.1.0",
"homepage": "http://www.lucagrulla.com/node-tail",

@@ -12,0 +12,0 @@ "repository": {

@@ -5,3 +5,3 @@ #tail

To install:
# Installation

@@ -12,3 +12,3 @@ ```bash

#Use:
# Use:
```javascript

@@ -26,25 +26,43 @@ Tail = require('tail').Tail;

});
````
The only mandatory parameter is the path to the file to tail. You can pass optional parameters passed via a hash:
```
If you want to stop tail:
```javascript
tail.unwatch()
```
To start watching again:
```javascript
tail.watch()
```
# Configuration
The only mandatory parameter is the path to the file to tail.
```javascript
var fileToTail = "/path/to/fileToTail.txt";
new Tail(fileToTail)
```
or
Optional parameters can be passed via a hash:
```javascript
var options= {lineSeparator= /[\r]{0,1}\n/, fromBeginning = false, watchOptions = {}, follow = true} //default value, equivalent to not passing
var options= {lineSeparator: /[\r]{0,1}\n/, fromBeginning: false, watchOptions: {}, follow: true, logger: console}
new Tail(fileToTail, options)
```
* `fileToTail` is the name (inclusive of the path) of the file to tail
* `options` is a hash. The following keys are accepted:
* `lineSeparator`: the line separator token (default `/[\r]{0,1}\n/` to handle linux/mac (9+)/windows)
* `watchOptions`: the full set of options that can be passed to `fs.watch` as per node documentation (default: {})
* `fromBeginning`: forces the tail of the file from the very beginning of it instead of from the first new line that will be appended (default: `false`)
* `follow`: simulate `tail -F` option. In the case the file is moved/renamed (or logrotated) if set to `true` `tail` will try to start tailing again after a 1 second delay, if set to `false` it will just emit an error event (default: `true`)
# Available parameters:
Tail emits two type of events:
* `lineSeparator`: the line separator token (default `/[\r]{0,1}\n/` to handle linux/mac (9+)/windows)
* `watchOptions`: the full set of options that can be passed to `fs.watch` as per node documentation (default: {})
* `fromBeginning`: forces the tail of the file from the very beginning of it instead of from the first new line that will be appended (default: `false`)
* `follow`: simulate `tail -F` option. In the case the file is moved/renamed (or logrotated), if set to `true` `tail` will try to start tailing again after a 1 second delay, if set to `false` it will just emit an error event (default: `true`)
* `logger`: a logger object(default: no logger). The passed logger has to respond to two methods:
* `info([data][, ...])`
* `error([data][, ...])`
# Emitted events
`Tail` emits two events:
* line

@@ -61,15 +79,4 @@ ```

If you want to stop the tail:
# Want to fork?
```javascript
tail.unwatch()
```
To start watching again:
```javascript
tail.watch()
```
#Want to fork ?
Tail is written in [CoffeeScript](http://jashkenas.github.com/coffee-script/).

@@ -80,2 +87,2 @@

#License
MIT. Please see License file for more details.
MIT. Please see License file for more details.
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