rotating-file-stream
Advanced tools
Comparing version 3.0.4 to 3.1.0
@@ -0,10 +1,9 @@ | ||
- 2023-02-09 - v3.1.0 | ||
- `ENOENT` errors while unlinking files now emits `"warning"` events rather than `"error"`. | ||
- 2022-05-25 - v3.0.4 | ||
- Fixed required Node.js version in README.md | ||
- devDependencies update | ||
- 2022-02-22 - v3.0.3 | ||
- Experimental ESM dist | ||
- devDependencies update | ||
- 2021-11-20 - v3.0.2 | ||
- Required **Node.js v14** | ||
- devDependencies update | ||
- 2021-11-06 - v3.0.1 | ||
@@ -14,34 +13,23 @@ - `external` event emitted even if in error | ||
- Minor [README.md](https://github.com/iccicci/rotating-file-stream/blob/master/README.md) fixes | ||
- devDependencies update | ||
- 2021-11-04 - v3.0.0 | ||
- Released v3 - please check the [README.md](https://www.npmjs.com/package/rotating-file-stream#upgrading-from-v2-to-v3) | ||
- devDependencies update | ||
- 2021-09-26 - v2.1.6 | ||
- Made the [package compliant with Node.js v14 and v16](https://github.com/iccicci/rotating-file-stream/issues/63) | ||
- Removed duplicated description for initialRotation option (thanks to [ttoomm318](https://github.com/ttoomm318)) | ||
- devDependencies update | ||
- 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 | ||
- 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)) | ||
- devDependencies update | ||
- 2020-07-07 - v2.1.3 | ||
- Fixed a bug causing EEXIST opening two files in same not existing directory in a rapid sequence (thanks to [jameslahm](https://github.com/jameslahm)) | ||
- devDependencies update | ||
- 2020-07-04 - v2.1.2 | ||
- Applied a change to use on mounts with the noexec option (thanks to [jvassev](https://github.com/jvassev)) | ||
- devDependencies update | ||
- 2020-05-13 - v2.1.1 | ||
- Bug fix for **teeToStdout** | ||
- devDependencies update | ||
- 2020-04-29 - v2.1.0 | ||
- **teeToStdout** option added | ||
- devDependencies update | ||
- 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 | ||
- 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)) | ||
- devDependencies update | ||
- 2019-11-24 - v2.0.0 | ||
@@ -55,38 +43,26 @@ - complete refactoring with TypeScript | ||
- Fixed a [bug](https://github.com/iccicci/rotating-file-stream/issues/39) when **immutable** and **history** are both set. | ||
- devDependencies update | ||
- 2019-10-01 - v1.4.4 | ||
- Fixed a [bug](https://github.com/iccicci/rotating-file-stream/issues/42) occurring adding properties to **Array.prototype** | ||
- devDependencies update | ||
- 2019-07-23 - v1.4.3 | ||
- Exported the options interface | ||
- devDependencies update | ||
- 2019-06-27 - v1.4.2 | ||
- Fixed a [bug causing a ERR_MULTIPLE_CALLBACK error](https://github.com/iccicci/rotating-file-stream/issues/36) (thanks to [rooftopsparrow](https://github.com/rooftopsparrow)) | ||
- devDependencies update | ||
- 2019-04-22 - v1.4.1 | ||
- From [istanbul](https://www.npmjs.com/package/istanbul) to [nyc](https://www.npmjs.com/package/nyc) for tests coverage | ||
- Several typos fixed in [README.md](https://github.com/iccicci/rotating-file-stream/blob/master/README.md); thanks to [dhurlburtusa](https://github.com/dhurlburtusa) | ||
- devDependencies update | ||
- 2019-01-09 - v1.4.0 | ||
- Fixed the [TimeoutOverflowWarning bug](https://github.com/iccicci/rotating-file-stream/issues/34) | ||
- Added **experimental** monthly rotation | ||
- devDependencies update | ||
- 2019-01-04 - v1.3.10 | ||
- Fixed a [bug occurring when two calls to _makePath_ are concurrently done](https://github.com/iccicci/rotating-file-stream/pull/33) (thanks to [cchare](https://github.com/cchare)) | ||
- devDependencies update | ||
- 2018-09-26 - v1.3.9 | ||
- Fixed TypeScript Definition file (thanks to [rakshith-ravi](https://www.npmjs.com/~rakshith-ravi) and [kbirger](https://www.npmjs.com/~kbirger)) | ||
- Added TOC and **TypeScript** import documentation | ||
- devDependencies update | ||
- 2018-09-18 - v1.3.8 | ||
- Added TypeScript Definition file (thanks to [rakshith-ravi](https://www.npmjs.com/~rakshith-ravi)) | ||
- 2018-07-19 - v1.3.7 | ||
- devDependencies update | ||
- 2018-04-05 - v1.3.6 | ||
- Discovered and solved: ["write after end" error with immutable option](https://github.com/iccicci/rotating-file-stream/issues/23) (thanks to [JcBernack](https://github.com/JcBernack)) | ||
- Added a test case to cover that bug | ||
- devDependencies update | ||
- 2018-03-15 - v1.3.5 | ||
- Using slightly faster timestamp generator function (thanks to [jorgemsrs](https://github.com/jorgemsrs)) | ||
- devDependencies update | ||
- 2017-11-13 - v1.3.4 | ||
@@ -97,6 +73,2 @@ - **immutable** option review | ||
- **immutable** option added | ||
- 2017-09-23 - v1.3.2 | ||
- devDependencies updated | ||
- 2017-09-21 - v1.3.1 | ||
- devDependencies updated | ||
- 2017-09-17 - v1.3.0 | ||
@@ -128,6 +100,3 @@ - **initialRotation** option added | ||
- 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 | ||
@@ -141,3 +110,2 @@ - Tested on node v6.0 | ||
- Tested on node v4.2 | ||
- Dependencies update | ||
- 2015-10-09 - v1.0.2 | ||
@@ -144,0 +112,0 @@ - README update |
@@ -33,2 +33,3 @@ "use strict"; | ||
this.fsStat = promises_1.stat; | ||
this.fsUnlink = promises_1.unlink; | ||
this.generator = generator; | ||
@@ -207,3 +208,3 @@ this.maxTimeout = 2147483640; | ||
await file.close(); | ||
return (0, promises_1.unlink)(filename); | ||
return this.unlink(filename); | ||
} | ||
@@ -312,3 +313,3 @@ async classical() { | ||
await this.gzip(filename); | ||
return (0, promises_1.unlink)(this.filename); | ||
return this.unlink(this.filename); | ||
} | ||
@@ -370,3 +371,3 @@ async gzip(filename) { | ||
const file = res.shift(); | ||
await (0, promises_1.unlink)(file.name); | ||
await this.unlink(file.name); | ||
this.emit("removed", file.name, true); | ||
@@ -378,3 +379,3 @@ } | ||
const file = res.shift(); | ||
await (0, promises_1.unlink)(file.name); | ||
await this.unlink(file.name); | ||
this.emit("removed", file.name, false); | ||
@@ -417,2 +418,12 @@ } | ||
} | ||
async unlink(filename) { | ||
try { | ||
await this.fsUnlink(filename); | ||
} | ||
catch (e) { | ||
if (e.code !== "ENOENT") | ||
throw e; | ||
this.emit("warning", e); | ||
} | ||
} | ||
} | ||
@@ -419,0 +430,0 @@ exports.RotatingFileStream = RotatingFileStream; |
@@ -29,2 +29,3 @@ "use strict"; | ||
fsStat; | ||
fsUnlink; | ||
generator; | ||
@@ -53,2 +54,3 @@ initPromise; | ||
this.fsStat = stat; | ||
this.fsUnlink = unlink; | ||
this.generator = generator; | ||
@@ -227,3 +229,3 @@ this.maxTimeout = 2147483640; | ||
await file.close(); | ||
return unlink(filename); | ||
return this.unlink(filename); | ||
} | ||
@@ -332,3 +334,3 @@ async classical() { | ||
await this.gzip(filename); | ||
return unlink(this.filename); | ||
return this.unlink(this.filename); | ||
} | ||
@@ -390,3 +392,3 @@ async gzip(filename) { | ||
const file = res.shift(); | ||
await unlink(file.name); | ||
await this.unlink(file.name); | ||
this.emit("removed", file.name, true); | ||
@@ -398,3 +400,3 @@ } | ||
const file = res.shift(); | ||
await unlink(file.name); | ||
await this.unlink(file.name); | ||
this.emit("removed", file.name, false); | ||
@@ -437,2 +439,12 @@ } | ||
} | ||
async unlink(filename) { | ||
try { | ||
await this.fsUnlink(filename); | ||
} | ||
catch (e) { | ||
if (e.code !== "ENOENT") | ||
throw e; | ||
this.emit("warning", e); | ||
} | ||
} | ||
} | ||
@@ -439,0 +451,0 @@ function buildNumberCheck(field) { |
@@ -8,4 +8,4 @@ /// <reference types="node" /> | ||
} | ||
export declare type Compressor = (source: string, dest: string) => string; | ||
export declare type Generator = (time: number | Date, index?: number) => string; | ||
export type Compressor = (source: string, dest: string) => string; | ||
export type Generator = (time: number | Date, index?: number) => string; | ||
interface RotatingFileStreamEvents { | ||
@@ -72,3 +72,3 @@ close: () => void; | ||
} | ||
declare type Callback = (error?: Error) => void; | ||
type Callback = (error?: Error) => void; | ||
interface Chunk { | ||
@@ -89,2 +89,3 @@ chunk: Buffer; | ||
private fsStat; | ||
private fsUnlink; | ||
private generator; | ||
@@ -128,4 +129,5 @@ private initPromise; | ||
private immutate; | ||
private unlink; | ||
} | ||
export declare function createStream(filename: string | Generator, options?: Options): RotatingFileStream; | ||
export {}; |
{ | ||
"name": "rotating-file-stream", | ||
"version": "3.0.4", | ||
"version": "3.1.0", | ||
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.", | ||
@@ -45,12 +45,12 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/mocha": "9.1.1", | ||
"@types/node": "17.0.35", | ||
"@typescript-eslint/eslint-plugin": "5.26.0", | ||
"@typescript-eslint/parser": "5.26.0", | ||
"eslint": "8.16.0", | ||
"mocha": "10.0.0", | ||
"@types/mocha": "10.0.1", | ||
"@types/node": "18.13.0", | ||
"@typescript-eslint/eslint-plugin": "5.51.0", | ||
"@typescript-eslint/parser": "5.51.0", | ||
"eslint": "8.33.0", | ||
"mocha": "10.2.0", | ||
"nyc": "15.1.0", | ||
"prettier": "2.6.2", | ||
"ts-node": "10.8.0", | ||
"typescript": "4.7.2" | ||
"prettier": "2.8.4", | ||
"ts-node": "10.9.1", | ||
"typescript": "4.9.5" | ||
}, | ||
@@ -57,0 +57,0 @@ "prettier": { |
@@ -9,3 +9,3 @@ # rotating-file-stream | ||
[![NPM downloads][npm-downloads-badge]][npm-url] | ||
[![Stars][stars-badge]][github-url] | ||
[![Stars][stars-badge]][stars-url] | ||
@@ -20,2 +20,3 @@ [![Types][types-badge]][npm-url] | ||
[deps-badge]: https://badgen.net/npm/dependents/rotating-file-stream?icon=npm | ||
[deps-url]: https://www.npmjs.com/package/rotating-file-stream?activeTab=dependents | ||
[donate-badge]: https://badgen.net/badge/donate/bitcoin?icon=bitcoin | ||
@@ -28,2 +29,3 @@ [donate-url]: https://blockchain.info/address/12p1p5q7sK75tPyuesZmssiMYr4TKzpSCN | ||
[stars-badge]: https://badgen.net/github/stars/iccicci/rotating-file-stream?icon=github | ||
[stars-url]: https://github.com/iccicci/rotating-file-stream/stargazers | ||
[travis-badge]: https://badgen.net/travis/iccicci/rotating-file-stream/master?icon=travis | ||
@@ -203,3 +205,3 @@ [travis-url]: https://app.travis-ci.com/github/iccicci/rotating-file-stream | ||
const rfs = require("rotating-file-stream"); | ||
const stream = rfs(generator, { | ||
const stream = rfs.createStream(generator, { | ||
size: "10M", | ||
@@ -422,3 +424,3 @@ interval: "30m" | ||
var rfs = require("rotating-file-stream"); | ||
var stream = rfs("file.log", { | ||
var stream = rfs.createStream("file.log", { | ||
size: "10M", | ||
@@ -431,3 +433,3 @@ compress: true | ||
var rfs = require("rotating-file-stream"); | ||
var stream = rfs("file.log", { | ||
var stream = rfs.createStream("file.log", { | ||
size: "10M", | ||
@@ -564,7 +566,7 @@ compress: (source, dest) => "cat " + source + " | gzip -c9 > " + dest | ||
**TypeScript** types are distibuted with the package itself. | ||
**TypeScript** types are distributed with the package itself. | ||
# Licence | ||
# License | ||
[MIT Licence](https://github.com/iccicci/rotating-file-stream/blob/master/LICENSE) | ||
[MIT License](https://github.com/iccicci/rotating-file-stream/blob/master/LICENSE) | ||
@@ -571,0 +573,0 @@ # Bugs |
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
1309
578
79381