UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

53 lines (52 loc) 1.87 kB
import { FileSystemHost } from "./../FileSystemHost"; export declare class FileUtils { private constructor(); /** * Ensure the directory exists synchronously. * @param host - File system host. * @param dirPath - Directory path. */ static ensureDirectoryExistsSync(host: FileSystemHost, dirPath: string): void; /** * Ensure the directory exists asynchronously. * @param host - File system host. * @param dirPath - Directory path. */ static ensureDirectoryExists(host: FileSystemHost, dirPath: string): Promise<void>; /** * Gets the current directory. */ static getCurrentDirectory(): string; /** * Joins the paths. * @param paths - Paths to join. */ static pathJoin(...paths: string[]): string; /** * Gets the standardized absolute path. * @param fileOrDirPath - Path to standardize. */ static getStandardizedAbsolutePath(fileOrDirPath: string): string; /** * Gets the directory path. * @param fileOrDirPath - Path to get the directory name from. */ static getDirPath(fileOrDirPath: string): string; /** * Gets the absolute path when absolute, otherwise gets the relative path from the base dir. * @param filePath - File path. * @param baseDir - Base dir to use when file path is relative. */ static getAbsoluteOrRelativePathFromPath(filePath: string, baseDir: string): string; /** * Changes all back slashes to forward slashes. * @param fileOrDirPath - Path. */ static standardizeSlashes(fileOrDirPath: string): string; /** * Checks if a file path matches a specified search string. * @param filePath - File path. * @param searchString - Search string. */ static filePathMatches(filePath: string | null, searchString: string | null): boolean; }