UNPKG

@surface/io

Version:
74 lines (73 loc) 3.16 kB
import { type Options } from "@surface/path-matcher"; /** * Asynchronous enumerate paths using given patterns. * @param patterns Patterns to match. Strings prefixed with "!" will be negated. * @param options Options to parse patterns. */ export declare function enumeratePaths(patterns: string | string[], options?: Options): AsyncGenerator<string>; /** * enumerate paths using given patterns. * @param patterns Patterns to match. Strings prefixed with "!" will be negated. * @param options Options to parse patterns. */ export declare function enumeratePathsSync(patterns: string | string[], options?: Options): Generator<string>; /** * Asynchronous Verifies if a path is a directory. * @param path Path to verify. If a URL is provided, it must use the `file:` protocol. */ export declare function isDirectory(path: string): Promise<boolean>; /** * Verifies if a path is a directory. * @param path Path to verify. If a URL is provided, it must use the `file:` protocol. */ export declare function isDirectorySync(path: string): boolean; /** * Verifies if a path is a file. * @param path Path to verify. If a URL is provided, it must use the `file:` protocol. */ export declare function isFile(path: string): Promise<boolean>; /** * Verifies if a path is a file. * @param path Path to verify. If a URL is provided, it must use the `file:` protocol. */ export declare function isFileSync(path: string): boolean; /** * Verifies if a path is a symbolic link. * @param path Path to verify. If a URL is provided, it must use the `file:` protocol. */ export declare function isSymbolicLink(path: string): Promise<boolean>; /** * Verifies if a path is a symbolic link. * @param path Path to verify. If a URL is provided, it must use the `file:` protocol. */ export declare function isSymbolicLinkSync(path: string): boolean; /** * Asynchronous list paths using given patterns. * @param pattern Pattern to match. * @param cwd Working dir. */ export declare function listPaths(pattern: string | string[], options?: Options): Promise<string[]>; /** * List paths using given patterns. * @param pattern Pattern to match. * @param cwd Working dir. */ export declare function listPathsSync(pattern: string | string[], options?: Options): string[]; /** * Asynchronous resolve and returns the path of the first resolved file and null otherwise. * @param files Files to look. * @param context Context used to resolve. */ export declare function lookup(files: string[], context?: string): Promise<string | null>; /** * Resolve and returns the path of the first resolved file and null otherwise. * @param files Files to look. * @param context Context used to resolve. */ export declare function lookupSync(files: string[], context?: string): string | null; /** * Looks from bottom to up for the target file/directory. * @param startPath Path to start resolution. If a URL is provided, it must use the `file:` protocol. * @param target Target file/directory. */ export declare function searchAbove(startPath: string, target: string): string | null;