rogerc / file-stream-rotator

NodeJS file stream rotator
MIT License
142 stars 68 forks source link

lastEntry match is not supporting directories #71

Closed yakirzana closed 2 years ago

yakirzana commented 4 years ago

Hi,

https://github.com/rogerc/file-stream-rotator/blob/d48e1ec847bd27bc7896462d0e56ba19f07c581e/FileStreamRotator.js#L483

It is not working correctly if the file name contains a directory.

const path = require('path');

const directory = "dir";
const name = "file.ext";
const nameWithNumber = "file.ext.2";

const fullPath = path.join(directory, name);
const FullNameWithNumber =path.join(directory, nameWithNumber);

console.log(FullNameWithNumber.match(fullPath)) /// null
console.log(nameWithNumber.match(name)) /// value
rogerc commented 2 years ago

if running under Windows, this might cause an issue. This will be corrected in the next major release in the coming months.