/** * @file FileSystem.ts * @author Gage Sorrell * @copyright (c) 2026 Gage Sorrell * @license MIT */ import { type FFileExtension } from "./FileSystem.Types.cjs"; /** * Determine whether the given {@link Extension | file extension} is valid on the current platform. * * @param Extension - The {@link FFileExtension | file extension} to test. * @returns {boolean} Whether the file extension is valid on the current platform. */ export declare function IsSupportedFileExtension(Extension: FFileExtension): boolean; /** * Given a path at which we wish to create a new file, check if a file at that * path already exists, and if so, then append `(${ number })` before the file * extension, consistent with the Windows Explorer handles conflicting file * names when pasting files. * * @param InPath - The path from which a safe path is derived. * * @returns {Promise} The path derived from the given {@link InPath | path} * at which no object yet exists. */ export declare function GetSafeNewPath(InPath: string): Promise; export declare const ReservedWindowsFileNames: readonly ["CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"]; export declare const InvalidCharacters: RegExp; /** * Determines whether the given {@link FileName} is valid within the given {@link DirectoryPath}. * * @remarks This *does* attempt to create a file at the desired path. The file is * temporary iff `!PersistNewFile`, and is never created when this function * returns `false`. * * @param DirectoryPath - The path to the directory in which you wish to check. * @param FileName - The desired file name. * @param PersistNewFile - If specified, whether to keep the otherwise-temporary file * created at the desired path. This defaults to `false`. * @param Extension - If provided, the function will only return `true` if * `FileName.endsWith(Extension)` *and* the `Extension` is a valid file extension. * * @returns {Promise} Whether a file of the given `FileName` can be created in `DirectoryPath`. */ export declare function IsValidFileNameOnSystem(DirectoryPath: string, FileName: string, PersistNewFile?: boolean, Extension?: FFileExtension | undefined): Promise; /** * Write a text file to a given {@link Path} having contents {@link Contents}. * * @param Path - The path of the file that will be written. * @param Contents - The text contents of the file to write. * * @returns {Promise} A {@link Promise} that resolves when the call to {@link Fs.writeFile} resolves. * * @example * ```typescript * import { WriteTextFile } from "@sorrell/utilities/fs"; * import { resolve } from "path"; * * const MyReadMe: string = "# ReadMe\n\nThis package accomplishes...\n"; * const MyReadMePath: string = resolve("."); * * await WriteTextFile(MyReadMePath, MyReadMe); * ``` */ export declare function WriteTextFile(Path: string, Contents: string): Promise; type DeletePhase = "Scanning" | "Deleting" | "Done"; type DeleteProgress = { Phase: DeletePhase; CurrentPath: string | null; DiscoveredEntries: number; TotalEntries: number; DeletedEntries: number; TotalBytes: number; DeletedBytes: number; }; type DeleteWithProgressOptions = { OnProgress?: (Progress: DeleteProgress) => void; Signal?: AbortSignal; }; export declare function DeleteWithProgress(RootPath: string, Options?: DeleteWithProgressOptions): Promise; export declare function IsValidFileSubpath(DirectoryPath: string, FilePath: string): boolean; export declare function IsPathContainedUnderDirectory(ParentPath: string, ChildPath: string): boolean; export {}; //# sourceMappingURL=FileSystem.d.cts.map