import { StandardSchemaV1 } from "./standard-schema.mjs"; import { Stats } from "node:fs"; //#region ../@warlock.js/fs/src/facade/options.d.ts /** Read options. `encoding: null` returns a `Buffer`; otherwise a decoded string. */ type ReadOptions = { encoding?: BufferEncoding | null; }; /** * JSON read options. `schema` validates the parsed value against any Standard * Schema (seal / zod / valibot); `default` is returned when the file is missing * (instead of throwing). */ type ReadJsonOptions = { schema?: StandardSchemaV1; default?: T; }; /** Write options shared by the string/Buffer writers. */ type WriteOptions = { /** Text encoding for string writes (default `utf-8`). Ignored for `Buffer`. */encoding?: BufferEncoding; /** Write via a temp file + rename so readers never see a half-written file. */ atomic?: boolean; /** Create missing parent directories (default `true`). */ ensureDir?: boolean; /** When `false`, throw if the target already exists (drives `create`). Default `true`. */ overwrite?: boolean; }; /** JSON write options — adds the pretty-print `indent` (default `2`). */ type WriteJsonOptions = WriteOptions & { indent?: number; }; /** JSON merge options — shallow spread by default; `deep` for a recursive merge. */ type MergeJsonOptions = WriteJsonOptions & { deep?: boolean; }; /** Copy options (files + directories). */ type CopyOptions = { /** Overwrite an existing destination (default `true`). */overwrite?: boolean; /** Throw if the destination already exists (default `false`). */ errorOnExist?: boolean; /** Follow symlinks instead of copying the link (default `false`). */ dereference?: boolean; }; /** Move options. `ensureDir` (default `true`) creates the destination's parent. */ type MoveOptions = { overwrite?: boolean; ensureDir?: boolean; }; /** Directory-listing options. `recursive` walks the whole tree. */ type ListOptions = { recursive?: boolean; }; /** Directory-walk options. */ type WalkOptions = { recursive?: boolean; followSymlinks?: boolean; }; /** One entry yielded by `walk()`. Discriminated by `type` (never `kind`). */ type WalkEntry = { path: string; name: string; type: "file" | "directory"; }; /** * Normalized stats — a small, stable shape (with the raw `node:fs.Stats` kept * on `raw` as an escape hatch). Discriminated by `type`, not `kind`. */ type FileStats = { path: string; name: string; size: number; type: "file" | "directory"; lastModified: Date; raw: Stats; }; /** * Normalize a raw `node:fs.Stats` into a {@link FileStats}. * * @param filePath - The path the stats were read for. * @param raw - The raw `node:fs.Stats`. * @returns The normalized stats. */ declare function normalizeStats(filePath: string, raw: Stats): FileStats; //#endregion export { CopyOptions, FileStats, ListOptions, MergeJsonOptions, MoveOptions, ReadJsonOptions, ReadOptions, WalkEntry, WalkOptions, WriteJsonOptions, WriteOptions, normalizeStats }; //# sourceMappingURL=options.d.mts.map