@jin7942/ray
Version:
Lightweight CI/CD deployment tool powered by Docker and Git
43 lines (42 loc) • 1.55 kB
TypeScript
/**
* Ensure that a directory exists, create it recursively if it doesn't.
*
* @param dirPath - Absolute or relative path to the directory.
*/
export declare function ensureDirectoryExists(dirPath: string): Promise<void>;
/**
* Append a log message to a file.
* - Automatically trims old log files if total log size exceeds threshold.
*
* @param dir - Directory path to save logs.
* @param filename - File name (e.g., 2025-04-05.log).
* @param content - Log message to write.
*/
export declare function appendToFile(dir: string, filename: string, content: string): Promise<void>;
/**
* Check total directory size and delete oldest files if limit exceeded.
*
* @param dir - Log directory.
* @param maxSizeBytes - Size threshold in bytes.
*/
export declare function trimLogsIfTooLarge(dir: string, maxSizeBytes: number): Promise<void>;
/**
* Reads a file as UTF-8 encoded text.
*
* @param filePath - The absolute or relative path to the file.
* @returns A promise that resolves to the file contents as a string.
*/
export declare function readFile(filePath: string): Promise<string>;
/**
* Checks whether a file exists at the given path.
*
* @param filePath - The path to the file to check.
* @returns A promise that resolves to true if the file exists, false otherwise.
*/
export declare function exists(filePath: string): Promise<boolean>;
/**
* Remove directory from directory path
*
* @param dirPath - The path to remove target of diretory path
*/
export declare function removeDirectory(dirPath: string): Promise<void>;