rotating-file-stream
Advanced tools
Comparing version 2.1.4 to 2.1.5
@@ -0,1 +1,4 @@ | ||
- 2021-02-19 - v2.1.5 | ||
- Changed \_writev to make it compliant with Node.js v14; this should solve [#67](https://github.com/iccicci/rotating-file-stream/issues/67) | ||
- devDependencies update | ||
- 2021-02-02 - v2.1.4 | ||
@@ -2,0 +5,0 @@ - Fixed a bug which [requires a write operation to emit errors on open](https://github.com/iccicci/rotating-file-stream/issues/62) (thanks to [Raynos](https://github.com/Raynos)) |
@@ -44,3 +44,2 @@ /// <reference types="node" /> | ||
encoding: BufferEncoding; | ||
next: Chunk; | ||
} | ||
@@ -83,2 +82,3 @@ export declare class RotatingFileStream extends Writable { | ||
private rewrite; | ||
private writeToStdOut; | ||
private init; | ||
@@ -85,0 +85,0 @@ private makePath; |
23
index.js
@@ -67,8 +67,8 @@ "use strict"; | ||
_write(chunk, encoding, callback) { | ||
this.rewrite({ chunk, encoding, next: null }, callback); | ||
this.rewrite([{ chunk, encoding }], 0, callback); | ||
} | ||
_writev(chunks, callback) { | ||
this.rewrite(chunks[0], callback); | ||
this.rewrite(chunks, 0, callback); | ||
} | ||
rewrite(chunk, callback) { | ||
rewrite(chunks, index, callback) { | ||
const destroy = (error) => { | ||
@@ -90,8 +90,8 @@ this.destroy(); | ||
return destroy(error); | ||
if (chunk.next) | ||
return this.rewrite(chunk.next, callback); | ||
if (++index !== chunks.length) | ||
return this.rewrite(chunks, index, callback); | ||
callback(); | ||
}; | ||
this.size += chunk.chunk.length; | ||
this.stream.write(chunk.chunk, chunk.encoding, (error) => { | ||
this.size += chunks[index].chunk.length; | ||
this.stream.write(chunks[index].chunk, chunks[index].encoding, (error) => { | ||
if (error) | ||
@@ -104,3 +104,3 @@ return done(error); | ||
if (this.options.teeToStdout && !process.stdout.destroyed) | ||
process.stdout.write(chunk.chunk, chunk.encoding); | ||
this.writeToStdOut(chunks[index].chunk, chunks[index].encoding); | ||
}; | ||
@@ -118,2 +118,5 @@ if (this.stream) { | ||
} | ||
writeToStdOut(buffer, encoding) { | ||
process.stdout.write(buffer, encoding); | ||
} | ||
init(callback) { | ||
@@ -321,3 +324,3 @@ const { immutable, initialRotation, interval, size } = this.options; | ||
intervalBoundsBig(now) { | ||
let year = now.getFullYear(); | ||
const year = now.getFullYear(); | ||
let month = now.getMonth(); | ||
@@ -444,3 +447,3 @@ let day = now.getDate(); | ||
history(filename, callback) { | ||
let { history } = this.options; | ||
const { history } = this.options; | ||
this.fsReadFile(history, "utf8", (error, data) => { | ||
@@ -447,0 +450,0 @@ if (error) { |
{ | ||
"name": "rotating-file-stream", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.", | ||
@@ -43,11 +43,12 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/mocha": "8.2.0", | ||
"@types/node": "14.14.22", | ||
"@typescript-eslint/eslint-plugin": "4.14.2", | ||
"@typescript-eslint/parser": "4.14.2", | ||
"eslint": "7.19.0", | ||
"mocha": "8.2.1", | ||
"@types/mocha": "8.2.1", | ||
"@types/node": "14.14.30", | ||
"@typescript-eslint/eslint-plugin": "4.15.1", | ||
"@typescript-eslint/parser": "4.15.1", | ||
"eslint": "7.20.0", | ||
"mocha": "8.3.0", | ||
"nyc": "15.1.0", | ||
"prettier": "2.2.1", | ||
"ts-node": "9.1.1", | ||
"typescript": "4.1.3" | ||
"typescript": "4.1.5" | ||
}, | ||
@@ -54,0 +55,0 @@ "prettier": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61062
821
10