Launch Week Day 4: Introducing Data Exports.Learn More
Socket
Book a DemoSign in
Socket

rotating-file-stream

Package Overview
Dependencies
Maintainers
2
Versions
71
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
2.0.1
to
2.0.2
+3
-0
CHANGELOG.md

@@ -0,1 +1,4 @@

- 2020-01-26 - v2.0.2
- Fixed two [bugs](https://github.com/iccicci/rotating-file-stream/pull/47)
- devDependencies update
- 2019-12-24 - v2.0.1

@@ -2,0 +5,0 @@ - Fixed a [bug about setTimeout on some node environments](https://github.com/iccicci/rotating-file-stream/pull/46) (thanks to [Rastopyr](https://github.com/Rastopyr))

@@ -79,2 +79,6 @@ "use strict";

return destroy(this.error);
if (!this.stream) {
this.opened = rewrite;
return;
}
const done = (error) => {

@@ -348,3 +352,5 @@ if (error)

const time = this.next - this.now().getTime();
this.timer = time > this.maxTimeout ? timers_1.setTimeout(set, this.maxTimeout) : timers_1.setTimeout(() => this.rotate(error => (this.error = error)), time);
if (time <= 0)
return this.rotate(error => (this.error = error));
this.timer = timers_1.setTimeout(set, time > this.maxTimeout ? this.maxTimeout : time);
this.timer.unref();

@@ -351,0 +357,0 @@ };

+7
-7
{
"name": "rotating-file-stream",
"version": "2.0.1",
"version": "2.0.2",
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.",

@@ -43,11 +43,11 @@ "scripts": {

"@types/mocha": "5.2.7",
"@types/node": "13.1.0",
"@typescript-eslint/eslint-plugin": "2.13.0",
"@typescript-eslint/parser": "2.13.0",
"@types/node": "13.5.0",
"@typescript-eslint/eslint-plugin": "2.17.0",
"@typescript-eslint/parser": "2.17.0",
"eslint": "6.8.0",
"mocha": "6.2.2",
"mocha": "7.0.1",
"nyc": "15.0.0",
"ts-node": "8.5.4",
"typescript": "3.7.4"
"ts-node": "8.6.2",
"typescript": "3.7.5"
}
}
const rfs = require(".");
const stream = rfs.createStream("file.log", { interval: "10s", compress: (source, dest) => `cat ${source} | gzip -c9 > ${dest}.gz`, maxFiles: 3 });
const nothing = () => {
stream.write("test\n");
setTimeout(nothing, 1000);
};
stream.on("error", e => console.log("error", e));
stream.on("warning", e => console.log("warning", e));
nothing();