UNPKG

@hyperlane-xyz/utils

Version:

General utilities and types for the Hyperlane network

35 lines 1.22 kB
/** * Removes trailing slash from a directory path. */ export declare function removeTrailingSlash(dirPath: string): string; /** * Resolves a file path, expanding ~ to the user's home directory. */ export declare function resolvePath(filePath: string): string; /** * Checks if a path points to an existing file. * Uses statSync to follow symlinks (important for ConfigMap mounts in Kubernetes). */ export declare function isFile(filepath: string): boolean; /** * Checks if a path exists (file or directory). */ export declare function pathExists(filepath: string): boolean; /** * Reads a file at the specified path. * @throws Error if file doesn't exist */ export declare function readFileAtPath(filepath: string): string; /** * Ensures the directory for a filepath exists, creating it if necessary. */ export declare function ensureDirectoryExists(filepath: string): void; /** * Writes content to a file, creating the directory if it doesn't exist. */ export declare function writeFileAtPath(filepath: string, value: string): void; /** * Writes content to a file with a trailing newline. */ export declare function writeToFile(filepath: string, content: string): void; //# sourceMappingURL=utils.d.ts.map