New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rotating-file-stream

Package Overview
Dependencies
Maintainers
2
Versions
68
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.1.1 to 1.1.2

interval.js

14

compress.js

@@ -11,5 +11,5 @@ "use strict";

function classical(count) {
var prevName = count == 1 ? this.name : this.generator(count - 1);
var thisName = this.generator(count);
var self = this;
var prevName;
var thisName;
var self = this;

@@ -33,2 +33,10 @@ if(this.options.rotate == count)

try {
prevName = count == 1 ? this.name : this.generator(count - 1);
thisName = this.generator(count);
}
catch(e) {
return callback(e);
}
var doIt = function(done) {

@@ -35,0 +43,0 @@ fs.rename(prevName, thisName, function(err) {

@@ -5,2 +5,3 @@ "use strict";

var fs = require("fs");
var interval = require("./interval");
var path = require("path");

@@ -17,6 +18,14 @@ var util = require("util");

options = {};
else
else {
if(typeof options != "object")
throw new Error("Don't know how to handle 'options' type: " + typeof options);
var tmp = {};
for(var i in options)
tmp[i] = options[i];
options = tmp;
}
utils.checkOptions(options);

@@ -65,9 +74,2 @@

RotatingFileStream.prototype._clear = function(done) {
if(this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
};
RotatingFileStream.prototype._close = function(done) {

@@ -100,3 +102,3 @@ if(this.stream) {

if(this.writing)
if(this.writing || this.rotation)
return;

@@ -181,48 +183,2 @@

RotatingFileStream.prototype._interval = function(now) {
now = new Date(now);
var year = now.getFullYear();
var month = now.getMonth();
var day = now.getDate();
var hours = now.getHours();
var num = this.options.interval.num;
var unit = this.options.interval.unit;
if(unit == "d")
hours = 0;
else
hours = parseInt(hours / num) * num;
this.prev = new Date(year, month, day, hours, 0, 0, 0).getTime();
if(unit == "d")
this.next = new Date(year, month, day + num, hours, 0, 0, 0).getTime();
else
this.next = new Date(year, month, day, hours + num, 0, 0, 0).getTime();
};
RotatingFileStream.prototype.interval = function() {
if(! this.options.interval)
return;
var now = this.now();
var unit = this.options.interval.unit;
if(unit == "d" || unit == "h") {
this._interval(now);
}
else {
var period = 1000 * this.options.interval.num;
if(unit == "m")
period *= 60;
this.prev = parseInt(now / period) * period;
this.next = this.prev + period;
}
this.timer = setTimeout(this.rotate.bind(this), this.next - now);
this.timer.unref();
};
RotatingFileStream.prototype.move = function(retry) {

@@ -321,2 +277,5 @@ var name;

for(var i in interval)
RotatingFileStream.prototype[i] = interval[i];
module.exports = RotatingFileStream;
{
"name": "rotating-file-stream",
"version": "1.1.1",
"version": "1.1.2",
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.",

@@ -5,0 +5,0 @@ "engines": {

@@ -11,2 +11,6 @@ # rotating-file-stream

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

@@ -298,2 +302,6 @@

### Known bugs
* [end method wrong implementation](https://github.com/iccicci/rotating-file-stream/issues/9)
### Bugs

@@ -305,2 +313,5 @@

* 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

@@ -307,0 +318,0 @@ * Dependencies update

@@ -193,2 +193,7 @@ "use strict";

self.on("rotated", function() {
self.rotation = null;
self._rewrite();
});
self.end = function(chunk, encoding, callback) {

@@ -195,0 +200,0 @@ self.ending = true;

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