UNPKG

histoire

Version:

A fast story book powered by Vite

31 lines • 2.5 kB
import { Buffer } from 'node:buffer'; /** Check every existing path segment; generated roots cannot cross symlinks. */ export declare function safeVisualPath(root: string, relative: string, create?: boolean): Promise<string>; /** Read only bounded regular files without treating malformed paths as absence. */ export declare function safeVisualRead(root: string, relative: string, maxBytes?: number): Promise<Buffer | undefined>; /** Private temporary copy awaiting atomic publication at its validated destination. */ export interface VisualStagedWrite { /** Canonical destination inside project. */ path: string; /** Sibling temporary file, renamed over destination on publication. */ temporary: string; } /** Write privately next to destination; caller must publish or discard staged file. */ export declare function stageVisualWrite(root: string, relative: string, bytes: Uint8Array | string): Promise<VisualStagedWrite>; /** Synchronous rename lets callers publish many files right after one synchronous fence. */ export declare function publishVisualStagedWrite(staged: VisualStagedWrite): void; /** Remove unpublished temporary file; published files are already gone from temporary path. */ export declare function discardVisualStagedWrite(staged: VisualStagedWrite): Promise<void>; /** Write privately then atomically publish one metadata or image file. */ export declare function safeVisualWrite(root: string, relative: string, bytes: Uint8Array | string, preparePublish?: (path: string) => Promise<() => void>): Promise<void>; /** Bounded synchronous read only for final publication fences on already validated paths. */ export declare function readVisualPublicationFile(path: string, maxBytes?: number): Buffer | undefined; /** List safe directory inventory; absent directory yields no saved cases. */ export declare function listVisualFiles(root: string, relative: string): Promise<string[]>; /** Delete one saved definition without deleting any baseline or image. */ export declare function removeVisualFile(root: string, relative: string): Promise<void>; /** Acquire exclusive cross-process write lock; contested or abandoned locks fail safely. */ export declare function acquireVisualLock(root: string, identity: string): Promise<() => Promise<void>>; /** Exclusive cross-process write lock held for one operation. */ export declare function withVisualLock<T>(root: string, identity: string, operation: () => Promise<T>): Promise<T>; //# sourceMappingURL=files.d.ts.map