Socket
Socket
Sign inDemoInstall

streamroller

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamroller - npm Package Compare versions

Comparing version 3.0.9 to 3.1.0

18

CHANGELOG.md
# streamroller Changelog
## 3.1.0
- [feat: tilde expansion for filename](https://github.com/log4js-node/streamroller/pull/135) - thanks [@peteriman](https://github.com/peteriman)
- [fix: better file validation](https://github.com/log4js-node/streamroller/pull/134) - thanks [@peteriman](https://github.com/peteriman)
- [chore(deps-dev): updated dependencies](https://github.com/log4js-node/streamroller/pull/140) - thanks [@peteriman](https://github.com/peteriman)
- chore(deps-dev): bump @commitlint/cli from 16.3.0 to 17.0.0
- chore(deps-dev): bump @commitlint/config-conventional from 16.2.4 to 17.0.0
- chore(deps-dev): bump @types/node from 17.0.33 to 17.0.35
- chore(deps-dev): bump eslint from 8.15.0 to 8.16.0
- chore(deps): updated package-lock.json
## 3.0.9

@@ -7,5 +17,5 @@

- [chore(deps): updated dependencies](https://github.com/log4js-node/streamroller/pull/132) - thanks [@peteriman](https://github.com/peteriman)
- chore(deps-dev): bump @commitlint/cli from 16.2.3 to 16.2.4
- chore(deps-dev): bump @commitlint/cli from 16.2.3 to 16.3.0
- chore(deps-dev): bump @commitlint/config-conventional from 16.2.1 to 16.2.4
- chore(deps-dev): bump @types/node from 17.0.26 to 17.0.32
- chore(deps-dev): bump @types/node from 17.0.26 to 17.0.33
- chore(deps-dev): bump eslint from 8.14.0 to 8.15.0

@@ -116,7 +126,7 @@ - chore(deps-dev): bump husky from 7.0.4 to 8.0.1

- [fix: for mode to apply to compressed file](https://github.com/log4js-node/streamroller/pull/65) - thanks [@rnd-debug](https://github.com/rnd-debug)
- [fix: for extra separator in filenames](https://github.com/log4js-node/streamroller/pull/75) - thanks [@peteriman](https://github.com/peteriman)
- [feat: allow for 0 backups (only hot file)](https://github.com/log4js-node/streamroller/pull/74) - thanks [@peteriman](https://github.com/peteriman)
- [feat: exposed fileNameSep to be configurable](https://github.com/log4js-node/streamroller/pull/67) - thanks [@laidaxian](https://github.com/laidaxian)
- [fix: for fileNameSep affecting globally](https://github.com/log4js-node/streamroller/pull/79) - thanks [@peteriman](https://github.com/peteriman)
- [fix: for mode to apply to compressed file](https://github.com/log4js-node/streamroller/pull/65) - thanks [@rnd-debug](https://github.com/rnd-debug)
- [fix: for extra separator in filenames](https://github.com/log4js-node/streamroller/pull/75) - thanks [@peteriman](https://github.com/peteriman)
- [refactor: moved to options.numBackups instead of options.daysToKeep](https://github.com/log4js-node/streamroller/pull/78) - thanks [@peteriman](https://github.com/peteriman)

@@ -123,0 +133,0 @@ - [test: improved test case performance for fakeNow](https://github.com/log4js-node/streamroller/pull/76) - thanks [@peteriman](https://github.com/peteriman)

@@ -37,3 +37,3 @@ const debug = require('debug')('streamroller:moveAndMaybeCompressFile');

// to avoid concurrency, the forked process which can create the file will proceed (using flags wx)
const writeStream = fs.createWriteStream(targetFilePath, {mode: options.mode, flags: "wx"})
const writeStream = fs.createWriteStream(targetFilePath, { mode: options.mode, flags: "wx" })
// wait until writable stream is valid before proceeding to read

@@ -40,0 +40,0 @@ .on("open", () => {

const debug = require("debug")("streamroller:RollingFileWriteStream");
const fs = require("fs-extra");
const path = require("path");
const os = require("os");
const newNow = require("./now");

@@ -43,2 +44,8 @@ const format = require("date-format");

throw new Error(`Invalid filename: ${filePath}`);
} else if (filePath.endsWith(path.sep)) {
throw new Error(`Filename is a directory: ${filePath}`);
} else {
// handle ~ expansion: https://github.com/nodejs/node/issues/684
// exclude ~ and ~filename as these can be valid files
filePath = filePath.replace(new RegExp(`^~(?=${path.sep}.+)`), os.homedir());
}

@@ -209,7 +216,7 @@ super(options);

mode: this.options.mode
}
};
await moveAndMaybeCompressFile(
sourceFilePath,
targetFilePath,
moveAndCompressOptions
moveAndCompressOptions
);

@@ -257,5 +264,11 @@ }

_renewWriteStream() {
const filePath = this.fileFormatter({
date: this.state.currentDate,
index: 0
});
// attempt to create the directory
const mkdir = (dir) => {
try {
return fs.mkdirSync(dir, {recursive: true});
return fs.mkdirSync(dir, { recursive: true });
}

@@ -290,6 +303,3 @@ // backward-compatible fs.mkdirSync for nodejs pre-10.12.0 (without recursive option)

mkdir(this.fileObject.dir);
const filePath = this.fileFormatter({
date: this.state.currentDate,
index: 0
});
const ops = {

@@ -300,2 +310,4 @@ flags: this.options.flags,

};
// try to throw EISDIR, EROFS, EACCES
fs.appendFileSync(filePath, "", ops);
this.currentFileStream = fs.createWriteStream(filePath, ops);

@@ -302,0 +314,0 @@ this.currentFileStream.on("error", e => {

{
"name": "streamroller",
"version": "3.0.9",
"version": "3.1.0",
"description": "file streams that roll over when size limits, or dates are reached",

@@ -34,6 +34,6 @@ "main": "lib/index.js",

"devDependencies": {
"@commitlint/cli": "^16.3.0",
"@commitlint/config-conventional": "^16.2.4",
"@types/node": "^17.0.33",
"eslint": "^8.15.0",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@types/node": "^17.0.35",
"eslint": "^8.16.0",
"husky": "^8.0.1",

@@ -40,0 +40,0 @@ "mocha": "^10.0.0",

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