import { HashAlgorithm } from "../hash.mjs"; import { CopyOptions, FileStats, ListOptions, MergeJsonOptions, MoveOptions, ReadJsonOptions, ReadOptions, WalkEntry, WalkOptions, WriteJsonOptions, WriteOptions } from "./options.mjs"; import { File } from "./file.mjs"; import { Directory } from "./directory.mjs"; //#region ../@warlock.js/fs/src/facade/fs.d.ts /** * The `fs` shorthand facade — an async, ergonomic surface over * `@warlock.js/fs`'s primitives: * * - `fs.files.*` — file operations * - `fs.dirs.*` — directory operations * - `fs.file(path)` / `fs.dir(path)` — lazy `File` / `Directory` handles * - `fs.exists(path)` — type-agnostic existence (file OR directory) * * Async-only by design: synchronous callers use the bare primitives * (`getFile` / `putFile` / …), which keep the package's `bare = sync`, * `*Async = async` charter. `fs.*` never sandboxes paths — path containment is * the storage layer's job. * * @example * import { fs } from "@warlock.js/fs"; * * await fs.files.put("cache/data.json", "{}", { atomic: true }); * const cfg = await fs.files.getJson("config.json", { schema, default: {} }); * const dir = fs.dir("uploads"); * if (await dir.isEmpty()) { ... } */ declare const fs: { files: { get: { (path: string): Promise; (path: string, options: ReadOptions & { encoding: null; }): Promise; (path: string, options: ReadOptions): Promise; }; getJson: (path: string, options?: ReadJsonOptions) => Promise; put: (path: string, content: string | Buffer, options?: WriteOptions) => Promise; putJson: (path: string, value: unknown, options?: WriteJsonOptions) => Promise; create: (path: string, content: string | Buffer, options?: WriteOptions) => Promise; createJson: (path: string, value: unknown, options?: WriteJsonOptions) => Promise; exists: (path: string) => Promise; remove: (path: string) => Promise; copy: (from: string, to: string, options?: CopyOptions) => Promise; move: (from: string, to: string, options?: MoveOptions) => Promise; stats: (path: string) => Promise; lastModified: (path: string) => Promise; hash: (path: string, algorithm?: HashAlgorithm) => Promise; append: (path: string, content: string | Buffer, options?: WriteOptions) => Promise; prepend: (path: string, content: string | Buffer, options?: WriteOptions) => Promise; appendLine: (path: string, line: string) => Promise; appendJsonLine: (path: string, value: unknown) => Promise; size: (path: string) => Promise; isEmpty: (path: string) => Promise; ensure: (path: string) => Promise; touch: (path: string) => Promise; edit: (path: string, editor: (content: string) => string | Promise) => Promise; editJson: (path: string, editor: (value: T) => T | Promise, options?: WriteJsonOptions) => Promise; mergeJson: >(path: string, partial: Partial, options?: MergeJsonOptions) => Promise; ensureJson: (path: string, fallback: T, options?: WriteJsonOptions) => Promise; checksumMatches: (path: string, expected: string, algorithm?: HashAlgorithm) => Promise; readLines: (path: string) => AsyncIterable; }; dirs: { ensure: (path: string) => Promise; remove: (path: string) => Promise; empty: (path: string) => Promise; exists: (path: string) => Promise; copy: (from: string, to: string, options?: CopyOptions) => Promise; move: (from: string, to: string, options?: MoveOptions) => Promise; stats: (path: string) => Promise; size: (path: string) => Promise; count: (path: string) => Promise; isEmpty: (path: string) => Promise; list: (path: string, options?: ListOptions) => Promise; listFiles: (path: string, options?: ListOptions) => Promise; listDirs: (path: string, options?: ListOptions) => Promise; walk: (root: string, options?: WalkOptions) => AsyncGenerator; hash: (path: string, algorithm?: HashAlgorithm) => Promise; }; /** * Hashing — `file`/`dir` are async (they read from disk); `string`/`buffer` * are sync (pure, in-memory — no IO to await). Defaults to SHA-256. */ hash: { file: (path: string, algorithm?: HashAlgorithm) => Promise; dir: (path: string, algorithm?: HashAlgorithm) => Promise; string: (content: string, algorithm?: HashAlgorithm) => string; buffer: (content: Buffer | Uint8Array, algorithm?: HashAlgorithm) => string; }; /** Does anything exist at this path (file OR directory)? */ exists(path: string): Promise; /** A lazy handle to a file path (no IO until a method is called). */ file(path: string): File; /** A lazy handle to a directory path (no IO until a method is called). */ dir(path: string): Directory; }; //#endregion export { fs }; //# sourceMappingURL=fs.d.mts.map