ailock
Version:
AI-Proof File Guard - Protect sensitive files from accidental AI modifications
55 lines • 1.48 kB
TypeScript
/**
* Path sanitization and normalization utilities
*/
export declare class PathSanitizer {
/**
* Sanitize and normalize a file path
*/
sanitizePath(inputPath: string): string;
/**
* Sanitize a filename (just the filename, not the full path)
*/
sanitizeFilename(filename: string): string;
/**
* Resolve and normalize a path
*/
resolvePath(inputPath: string, basePath?: string): string;
/**
* Get the canonical path (resolve symlinks)
*/
getCanonicalPath(inputPath: string): Promise<string>;
/**
* Validate path type (file or directory)
*/
validatePathType(filePath: string, expectedType: 'file' | 'directory'): Promise<void>;
/**
* Validate file access permissions
*/
validateFileAccess(filePath: string, mode?: number): Promise<void>;
/**
* Get human-readable permission string
*/
private getModeString;
/**
* Extract directory and filename from a path
*/
parsePath(inputPath: string): {
dir: string;
name: string;
base: string;
ext: string;
};
/**
* Join path segments safely
*/
joinPath(...segments: string[]): string;
/**
* Get relative path between two paths
*/
getRelativePath(from: string, to: string): string;
/**
* Check if a path is absolute
*/
isAbsolutePath(inputPath: string): boolean;
}
//# sourceMappingURL=PathSanitizer.d.ts.map