import type { FileStat } from '../../../../types.ts'; import type { LinkView } from '../../../../ops/types.ts'; import type { Dispatch } from './types.ts'; /** Read one virtual path through the workspace dispatcher. */ export declare function readFile(dispatch: Dispatch, path: string): Promise; /** * The bytes git stores for one working-tree entry. * * A symlink's blob is its target string, not what the target holds, so reading * through the link would stage a second copy of the target under mode 100644 * and then report the entry modified forever after (the staged blob and the * bytes behind the link never match). The target is namespace state, which is * why it arrives on the stat rather than from a read. */ export declare function entryBytes(dispatch: Dispatch, path: string, info: FileStat): Promise; /** * Materialize one tree entry into the working tree. * * A 120000 entry is a symlink whose blob is the target string, so it is * restored through the namespace rather than written as content: writing the * blob would leave a regular file spelling the target. * * Whatever is already there goes first, whichever kind it is, because git * replaces a tree entry rather than merging with it. Two of the four * combinations are the ones that corrupt state: writing a regular blob at a * path the namespace holds a link for follows the link and lands the content in * the file it points at, damaging a path no branch touched while the link * stays; and linking over a regular file leaves that file behind the link, * ready to reappear when the link goes. The fourth, a link over a link, is the * retarget a checkout does when a branch moves where a link points: symlink(2) * does not overwrite, so the old name is removed rather than replaced in place. * The check is a namespace lookup, so the ordinary file-for-file case costs * nothing. */ export declare function restoreEntry(dispatch: Dispatch, path: string, mode: string, blob: Uint8Array, links?: LinkView | null): Promise; /** Read a byte range of one virtual path. */ export declare function readRange(dispatch: Dispatch, path: string, offset: number, size: number): Promise; /** * Read a path that a repository may legitimately not have. * * `packed-refs` and `HEAD`-adjacent files are absent in perfectly valid * repositories, so a miss is an answer rather than an error. */ export declare function readOptional(dispatch: Dispatch, path: string): Promise; /** List a directory, empty when it does not exist. */ export declare function readNames(dispatch: Dispatch, path: string): Promise; /** * Create a directory and every missing directory above it. * * Written out rather than delegated to `mkdir -p` because the parents flag is a * per-backend capability: the ops factory only wires `parents: true` for * backends that declare it, so a plain `mkdir` of `objects/ab` fails on the * rest. * * Existence is probed with a point stat, which on a prefix store misses a * directory that has no object of its own. That false negative is harmless here * and the reason this does not need the two-channel stat: on such a store a * directory is the set of keys under it, so creating one again costs a no-op * rather than an error. */ export declare function ensureDir(dispatch: Dispatch, path: string): Promise; /** * Whether a path names a directory, false when nothing is there. * * Asked with a stat rather than inferred from a failed read: a read of a * directory misses on a keyed store and raises EISDIR on disk, so "the read did * not work" says nothing about what the path is. */ export declare function isDirectory(dispatch: Dispatch, path: string): Promise; /** Whether a point lookup finds anything at a path. */ export declare function exists(dispatch: Dispatch, path: string): Promise; /** Write one virtual path, creating the directories above it. */ export declare function writeFile(dispatch: Dispatch, path: string, data: Uint8Array): Promise; /** * Delete one virtual path, tolerating one that is already gone. * * A miss is an answer rather than an error for every caller here: unstaging a * path deletes whatever ref or lock may or may not exist, and a checkout removes * files the other branch does not have. */ export declare function removeFile(dispatch: Dispatch, path: string): Promise; /** Join path segments below a git directory, POSIX style. */ export declare function under(base: string, ...parts: string[]): string; //# sourceMappingURL=io.d.ts.map