simple-fs-rotator
Version:
Automated stream rotation useful for log files
23 lines (22 loc) • 815 B
TypeScript
import { AuditEntry, DateComponents, RotationSettings } from "./types";
export default class Rotator {
settings: RotationSettings;
private currentSize;
private lastDate;
private fileIndx;
constructor(settings: RotationSettings, lastEntry?: AuditEntry);
private getSizeForFile;
hasMaxSizeReached(): boolean;
hasMaxFilesReached(): boolean;
shouldRotate(): boolean;
private isFormatValidForDaily;
private isFormatValidForHour;
private isFormatValidForMinutes;
getDateString(date?: Date): string;
private getFilename;
getNewFilename(): string;
addBytes(bytes: number): void;
rotate(force?: boolean): void;
static getDateComponents(date: Date, utc: boolean): DateComponents;
static createDate(components: DateComponents, utc: boolean): Date;
}