import * as fsp from "node:fs/promises"; import * as nodePath from "node:path"; import * as fsExtra from "fs-extra"; import { Buffer } from "node:buffer"; import { Abortable } from "node:events"; import * as fs from "node:fs"; import { JFReadOptions, JFWriteOptions } from "jsonfile"; //#region src/path.d.ts type DoNotRemoveOrUseThisType = typeof fsExtra; type DropFirstParameters any> = Parameters extends [any, ...infer R] ? R : never; type PathLike = fs.PathLike | Path; /** * Class representing a file system path with various utility methods for path operations. * * All methods in the `Path` class are immutable, returning new instances with modified values * and leaving the original instance unchanged. */ declare class Path { #private; constructor(...paths: PathLike[]); [Symbol.toPrimitive](hint: string): string; /** * @see {@link nodePath.dirname} */ get parent(): Path; /** * Returns the internal path string value. */ get value(): string; /** * @see {@link nodePath.format} */ static format(pathObject: nodePath.FormatInputPathObject): Path; /** * @see {@link nodePath.resolve} */ static resolve(...paths: PathLike[]): Path; /** * @see {@link nodePath.basename} */ basename(suffix?: string): string; /** * @see {@link nodePath.dirname} */ dirname(): Path; /** * @see {@link nodePath.extname} */ extname(): string; /** * @see {@link nodePath.isAbsolute} */ isAbsolute(): boolean; /** * @see {@link nodePath.normalize} */ normalize(): Path; /** * @see {@link nodePath.join} */ join(...paths: PathLike[]): Path; /** * @see {@link nodePath.parse} */ parse(): nodePath.ParsedPath; /** * @see {@link nodePath.relative} */ relative(to: PathLike): Path; /** * @see {@link nodePath.resolve} */ resolve(): Path; toJSON(): string; /** * @see {@link nodePath.toNamespacedPath} */ toNamespacedPath(): string; /** * Converts the Path instance to a string. * This method returns the internal path string value, * making it useful for implicit and explicit string conversions. */ toString(): string; /** * @see {@link fsp.access} */ access(...args: DropFirstParameters): Promise; /** * @see {@link fsp.appendFile} */ appendFile(...args: DropFirstParameters): Promise; /** * @see {@link fsp.chmod} */ chmod(...args: DropFirstParameters): Promise; /** * @see {@link fsp.chown} */ chown(...args: DropFirstParameters): Promise; /** * @see {@link fsp.copyFile} */ copyFile(...args: DropFirstParameters): Promise; /** * @see {@link fsp.mkdir} */ mkdir(options: fs.MakeDirectoryOptions & { recursive: true; }): Promise; mkdir(options?: (fs.MakeDirectoryOptions & { recursive?: false; }) | fs.Mode | null): Promise; mkdir(options?: fs.MakeDirectoryOptions | fs.Mode | null): Promise; /** * @see {@link fsp.open} */ open(...args: DropFirstParameters): Promise; /** * @see {@link fsp.readdir} */ readdir(path: PathLike, options?: BufferEncoding | (fs.ObjectEncodingOptions & { recursive?: boolean; withFileTypes?: false; }) | null): Promise; readdir(path: PathLike, options: 'buffer' | { encoding: 'buffer'; recursive?: boolean; withFileTypes?: false; }): Promise; readdir(path: PathLike, options?: BufferEncoding | (fs.ObjectEncodingOptions & { recursive?: boolean; withFileTypes?: false; }) | null): Promise; readdir(path: PathLike, options: fs.ObjectEncodingOptions & { recursive?: boolean; withFileTypes: true; }): Promise; readdir(path: PathLike, options: { encoding: 'buffer'; recursive?: boolean; withFileTypes: true; }): Promise[]>; /** * @see {@link fsp.readFile} */ readFile(options?: (Abortable & { encoding?: null; flag?: fs.OpenMode; }) | null): Promise; readFile(options: (Abortable & { encoding: BufferEncoding; flag?: fs.OpenMode; }) | BufferEncoding): Promise; readFile(options?: (Abortable & fs.ObjectEncodingOptions & { flag?: fs.OpenMode; }) | BufferEncoding | null): Promise; /** * @see {@link fsp.rename} */ rename(newPath: PathLike): Promise; /** * @see {@link fsp.rm} */ rm(...args: DropFirstParameters): Promise; /** * @see {@link fsp.rmdir} */ rmdir(...args: DropFirstParameters): Promise; /** * @see {@link fsp.stat} */ stat(opts?: fs.StatOptions & { bigint?: false; }): Promise; stat(opts: fs.StatOptions & { bigint: true; }): Promise; stat(opts?: fs.StatOptions): Promise; /** * @see {@link fsp.truncate} */ truncate(...args: DropFirstParameters): Promise; /** * @see {@link fsp.unlink} */ unlink(): Promise; /** * @see {@link fsp.writeFile} */ writeFile(...args: DropFirstParameters): Promise; /** * @see {@link fsExtra.ensureDir} */ ensureDir(options?: fsExtra.EnsureDirOptions | number): Promise; /** * @see {@link fsExtra.ensureDir} */ mkdirp: (options?: fsExtra.EnsureDirOptions | number) => Promise; /** * @see {@link fsExtra.ensureDir} */ mkdirs: (options?: fsExtra.EnsureDirOptions | number) => Promise; /** * @see {@link fsExtra.readJson} */ readJson(options?: JFReadOptions): Promise; /** * @see {@link fsExtra.remove} */ remove(): Promise; /** * @see {@link fsExtra.writeJson} */ writeJson(data: any, options?: JFWriteOptions): Promise; } //#endregion export { DoNotRemoveOrUseThisType, Path, PathLike }; //# sourceMappingURL=path.d.ts.map