/** * Path Utilities * * Provides safe path manipulation and validation utilities * Prevents path traversal attacks and ensures consistent path handling */ /** * Path validation result */ export interface PathValidationResult { valid: boolean; error?: string; resolvedPath: string; } /** * Directory entry with type information */ export interface DirectoryEntry { name: string; path: string; isDirectory: boolean; isFile: boolean; isSymlink: boolean; size: number; modifiedTime: Date; } /** * Resolve a path relative to a base directory * Prevents path traversal attacks */ export declare function safePath(basePath: string, relativePath: string): PathValidationResult; /** * Join paths safely, preventing traversal */ export declare function safeJoin(basePath: string, ...segments: string[]): string; /** * Check if a path is within a base directory */ export declare function isWithinDirectory(basePath: string, testPath: string): boolean; /** * Expand ~ to user home directory */ export declare function expandHome(path: string): string; /** * Normalize a path, expanding home directory and resolving to absolute */ export declare function normalizePath(path: string): string; /** * Get a unique filename by appending a number if file exists */ export declare function getUniqueFilename(basePath: string, filename: string): string; /** * Ensure a directory exists, creating it if necessary */ export declare function ensureDirectory(path: string): Promise; /** * Ensure a directory exists (synchronous) */ export declare function ensureDirectorySync(path: string): void; /** * Check if a path exists and is accessible */ export declare function pathExists(path: string): Promise; /** * Check if a path is a directory */ export declare function isDirectory(path: string): Promise; /** * Check if a path is a file */ export declare function isFile(path: string): Promise; /** * Check if a path is readable */ export declare function isReadable(path: string): Promise; /** * Check if a path is writable */ export declare function isWritable(path: string): Promise; /** * Get directory contents with type information */ export declare function listDirectory(path: string): Promise; /** * Find files matching a pattern in a directory */ export declare function findFiles(dir: string, pattern: RegExp, options?: { recursive?: boolean; maxDepth?: number; }): Promise; /** * Get the relative path between two paths */ export declare function getRelativePath(from: string, to: string): string; /** * Get a temporary directory path */ export declare function getTempDir(subdir?: string): string; /** * Sanitize a filename (remove invalid characters) */ export declare function sanitizeFilename(filename: string): string; /** * Check if a filename is valid */ export declare function isValidFilename(filename: string): boolean; /** * Extract the plugin name from a JAR filename */ export declare function extractPluginName(jarFilename: string): string; //# sourceMappingURL=path.d.ts.map