Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rotating-file-stream

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rotating-file-stream - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

CHANGELOG.md

12

compress.js

@@ -122,8 +122,8 @@ "use strict";

self.gzip(tmp, name, done);
/*
if(self.options.compress == "gzip")
self.gzip(tmp, name, done);
else
throw new Error("Not implemented yet");
*/
/*
if(self.options.compress == "gzip")
self.gzip(tmp, name, done);
else
throw new Error("Not implemented yet");
*/
});

@@ -130,0 +130,0 @@ });

@@ -19,11 +19,10 @@ "use strict";

this.generator = filename;
else if(typeof filename === "string") {
if(options.rotate)
this.generator = utils.createClassical(filename);
else
this.generator = utils.createGenerator(filename);
}
else
if(typeof filename === "string") {
if(options.rotate)
this.generator = utils.createClassical(filename);
else
this.generator = utils.createGenerator(filename);
}
else
throw new Error("Don't know how to handle 'filename' type: " + typeof filename);
throw new Error("Don't know how to handle 'filename' type: " + typeof filename);

@@ -38,2 +37,5 @@ if(options.path) {

if(options.rotationTime && options.initialRotation)
options.initialRotation = null;
var opt = {};

@@ -179,2 +181,13 @@

if(self.options.interval && self.options.initialRotation) {
var prev;
self._interval(self.now());
prev = self.prev;
self._interval(stats.mtime.getTime());
if(prev !== self.prev)
return self.rotate();
}
self.size = stats.size;

@@ -181,0 +194,0 @@

@@ -117,12 +117,11 @@ "use strict";

}
else if(stats.isFile()) {
res.push({
name: files[idx],
size: stats.size,
time: stats.ctime.getTime()
});
}
else
if(stats.isFile()) {
res.push({
name: files[idx],
size: stats.size,
time: stats.ctime.getTime()
});
}
else
self.emit("warning", "File '" + files[idx] + "' contained in history is not a regular file");
self.emit("warning", "File '" + files[idx] + "' contained in history is not a regular file");

@@ -129,0 +128,0 @@ historyGather(self, files, idx + 1, res);

{
"name": "rotating-file-stream",
"version": "1.2.2",
"version": "1.3.0",
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.",
"scripts": {
"all": "npm run npmignore && npm run eslint && npm run coverage",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --recursive test",
"all": "npm install && npm run npmignore && npm run eslint && npm run coverage",
"coverage": "TZ=\"Europe/Rome\" ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --recursive test",
"eslint": "./node_modules/.bin/eslint *.js test/*js",
"npmignore": "echo '.codeclimate.yml\\n.eslintrc\\n.gitignore\\n.travis.yml\\ntest' > .npmignore ; cat .gitignore >> .npmignore",
"test": "./node_modules/.bin/_mocha test"
"npmignore": "echo '.codeclimate.yml\\n.eslintrc\\n.gitignore\\n.travis.yml\\nCHANGELOG.md\\ntest' > .npmignore ; cat .gitignore >> .npmignore",
"test": "TZ=\"Europe/Rome\" ./node_modules/.bin/_mocha test"
},

@@ -24,2 +24,3 @@ "bugs": "https://github.com/iccicci/rotating-file-stream/issues",

"contributors": [
"cicci",
"allevo"

@@ -30,7 +31,7 @@ ],

"devDependencies": {
"eslint": "3.19.0",
"eslint": "4.5.0",
"istanbul": "0.4.5",
"mocha-istanbul": "0.3.0",
"mocha": "3.3.0"
"mocha": "3.5.0"
}
}

@@ -14,4 +14,2 @@ # rotating-file-stream

[![NPM](https://nodei.co/npm-dl/rotating-file-stream.png?height=3)](https://nodei.co/npm/rotating-file-stream/)
### Description

@@ -102,2 +100,4 @@

If classical __logrotate__ behaviour is enabled _rotated file name_ is only a function of _index_.
#### function filename(index)

@@ -107,3 +107,8 @@

If classical __logrotate__ behaviour is enabled _rotated file name_ is only a function of _index_.
__Note:__
The _not-rotated file name_ __must__ be only the _filename_, to specify a _path_ the appropriate option __must__ be used.
```javascript
rfs('path/to/file.log'); // wrong
rfs('file.log', { path: 'path/to' }); // OK
```

@@ -118,2 +123,3 @@ __Note:__

* history: {String} (default: null) Specifies the _history filename_.
* initialRotation: {Boolean} (default: null) Eventually makes an initial rotation based on _not-rotated file_ timestamp.
* interval: {String} (default: null) Specifies the time interval to rotate the file.

@@ -125,4 +131,3 @@ * maxFiles: {Integer} (default: null) Specifies the maximum number of rotated files to keep.

* rotate: {Integer} (default: null) Enables the classical UNIX __logrotate__ behaviour.
* rotationTime: {Boolean} (default: null) Makes rotated file name with time of rotation instead of start time of
period.
* rotationTime: {Boolean} (default: null) Makes rotated file name with time of rotation instead of start time of period.
* size: {String} (default: null) Specifies the file size to rotate the file.

@@ -229,2 +234,11 @@

#### initialRotation
When program stops in a rotation period then restarts in a new rotation period, logs of differente rotation period will
go in the next rotated file; in a few words: a rotation job is lost. If this option is set to __true__ an initial check
is performed against the _not-rotated file_ timestamp and, if it falls in a previous rotation period, an initial
rotation job is done as well.
__Note:__
this option is ignored if __rotationTime__ is set to __true__.
#### rotate

@@ -251,3 +265,3 @@

If specified, it's value must respect same syntax of [(size)](#size) option and is the maximum size of _rotated files_
If specified, it's value must respect same syntax of [size](#size) option and is the maximum size of _rotated files_
to be kept.

@@ -335,3 +349,3 @@

This package is written following __Node.js 4.0__ specifications always taking care about backward
compatibility. The package it tested under
compatibility. The package is tested under
[several Node.js versions](https://travis-ci.org/iccicci/rotating-file-stream).

@@ -349,2 +363,6 @@

## ChangeLog
[ChangeLog](https://github.com/iccicci/rotating-file-stream/blob/master/CHANGELOG.md)
## Donating

@@ -354,63 +372,1 @@

__12p1p5q7sK75tPyuesZmssiMYr4TKzpSCN__
## ChangeLog
* 2017-04-26 - v1.2.2
* Fixed bug: [Handle does not close](https://github.com/iccicci/rotating-file-stream/issues/11)
* 2017-03-22 - v1.2.1
* fixed removed event
* 2017-03-20 - v1.2.0
* __maxFiles__ and __maxSize__ options added
* 2017-02-14 - v1.1.9
* fixed warning events order in case of external compression errors
* 2017-02-13 - v1.1.8
* removed tmp dependecy due it was causing a strange instability now disappeared
* 2017-02-07 - v1.1.7
* fixed tmp.file call
* 2017-02-03 - v1.1.6
* eslint
* 2017-01-23 - v1.1.5
* README fix
* 2017-01-23 - v1.1.4
* Changed dependencies badges
* 2016-12-27 - v1.1.3
* Fixed bug: [end method wrong implementation](https://github.com/iccicci/rotating-file-stream/issues/9)
* 2016-12-19 - v1.1.2
* Fixed bug: [unable to reuse configuration object](https://github.com/iccicci/rotating-file-stream/issues/10)
* Fixed bug: [Events cross over: rotate and rotated](https://github.com/iccicci/rotating-file-stream/issues/6)
* 2016-12-05 - v1.1.1
* Dependencies update
* 2016-10-18 - v1.1.0
* Added classical __UNIX logrotate__ tool behaviour.
* Dependencies update
* 2016-04-29 - v1.0.5
* Tested on node v6.0
* Fixed a bug on rotation with interval and compression
* 2015-11-09 - v1.0.4
* Tested on node v5.0
* Fixed bug on [initial rotation with interval](https://github.com/iccicci/rotating-file-stream/issues/2)
* 2015-10-25 - v1.0.3
* Tested on node v4.2
* Dependencies update
* 2015-10-09 - v1.0.2
* README update
* 2015-10-08 - v1.0.1
* README fix
* 2015-10-08 - v1.0.0
* Async error reporting refactory
* 2015-10-07 - v0.1.0
* Internal gzip compression
* 2015-10-06 - v0.0.5
* External compression
* 2015-09-30 - v0.0.4
* Added _path_ option
* Missing path creation
* 2015-09-29 - v0.0.3
* Rotation by interval
* __Buffer__ optimization (thanks to [allevo](https://www.npmjs.com/~allevo))
* 2015-09-17 - v0.0.2
* Rotation by size
* 2015-09-14 - v0.0.1
* README.md
* 2015-09-10 - v0.0.0
* Embryonal stage

@@ -107,11 +107,9 @@ "use strict";

options.compress = function(src, dst) { return "cat " + src + " | gzip -c9 > " + dst; };
else
if(typ === "string") {
//if(val != "bzip" && val != "gzip")
if(val !== "gzip")
throw new Error("Don't know how to handle compression method: " + val);
}
else
if(typ !== "function")
throw new Error("Don't know how to handle 'options.compress' type: " + typ);
else if(typ === "string") {
//if(val != "bzip" && val != "gzip")
if(val !== "gzip")
throw new Error("Don't know how to handle compression method: " + val);
}
else if(typ !== "function")
throw new Error("Don't know how to handle 'options.compress' type: " + typ);
},

@@ -126,2 +124,4 @@

"initialRotation": function() {},
"interval": buildStringCheck("interval", checkInterval),

@@ -128,0 +128,0 @@

Sorry, the diff of this file is not supported yet

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