import { HashAlgorithm } from "../hash.mjs"; import { CopyOptions, FileStats, MergeJsonOptions, MoveOptions, ReadJsonOptions, ReadOptions, WriteJsonOptions, WriteOptions } from "./options.mjs"; import { Directory } from "./directory.mjs"; //#region ../@warlock.js/fs/src/facade/file.d.ts /** * A lazy, **immutable** handle to a file path. The constructor does zero IO; * path helpers (`name`/`extension`/`basename`/`parent`) are pure `node:path`. * `copy`/`move`/`copyTo`/`moveTo`/`rename` return a NEW handle to the * destination and never mutate `this.path`. * * @example * const pkg = fs.file("package.json"); * await pkg.editJson((p) => ({ ...p, version: "4.7.0" })); * pkg.extension; // ".json" */ declare class File { readonly path: string; constructor(path: string); /** Basename including extension (`"user.model.ts"`). */ get name(): string; /** Basename without extension (`"user.model"`). */ get basename(): string; /** Extension including the dot (`".ts"`), or `""` when there is none. */ get extension(): string; /** Handle to the parent directory (pure path — no IO). */ parent(): Directory; get(): Promise; get(options: ReadOptions & { encoding: null; }): Promise; get(options: ReadOptions): Promise; getJson(options?: ReadJsonOptions): Promise; put(content: string | Buffer, options?: WriteOptions): Promise; putJson(value: unknown, options?: WriteJsonOptions): Promise; append(content: string | Buffer, options?: WriteOptions): Promise; prepend(content: string | Buffer, options?: WriteOptions): Promise; appendJsonLine(value: unknown): Promise; edit(editor: (content: string) => string | Promise): Promise; editJson(editor: (value: T) => T | Promise, options?: WriteJsonOptions): Promise; mergeJson>(partial: Partial, options?: MergeJsonOptions): Promise; exists(): Promise; isEmpty(): Promise; ensure(): Promise; touch(): Promise; remove(): Promise; copy(to: string, options?: CopyOptions): Promise; /** Copy into a directory, keeping this file's name. */ copyTo(dir: string | Directory, options?: CopyOptions): Promise; move(to: string, options?: MoveOptions): Promise; /** Move into a directory, keeping this file's name. */ moveTo(dir: string | Directory, options?: MoveOptions): Promise; /** Rename within the same parent directory. */ rename(newName: string, options?: MoveOptions): Promise; stats(): Promise; size(): Promise; lastModified(): Promise; hash(algorithm?: HashAlgorithm): Promise; readLines(): AsyncIterable; } //#endregion export { File }; //# sourceMappingURL=file.d.mts.map