/** * Abstraction over a zip archive used by the agent backup feature. * * Export and import depend on this interface rather than on `adm-zip` * directly (Dependency Inversion). All path arguments that point at the * filesystem are absolute; all `archivePath` arguments are POSIX-style * paths *inside* the archive. */ export interface Archive { /** Add a single file. No-op if the source is missing or not a file. */ addFile(absSource: string, archivePath: string): void; /** Add a directory tree. No-op if the source is missing or not a dir. */ addDir(absSourceDir: string, archiveDir: string): void; /** Add raw bytes at the given archive path. */ addBuffer(archivePath: string, data: Buffer): void; /** Persist the archive to disk. */ write(destPath: string): void; /** All entry paths in the archive (POSIX-style, dirs end with `/`). */ entryPaths(): string[]; /** Read a text entry, or `undefined` if it does not exist. */ readText(archivePath: string): string | undefined; /** * Extract every entry whose path starts with `archiveDirPrefix` into * `destAbsDir`, preserving the structure *below* the prefix. * Returns the number of files written. */ extractDir(archiveDirPrefix: string, destAbsDir: string): number; } /** `adm-zip`-backed {@link Archive} implementation. */ export declare class AdmZipArchive implements Archive { private readonly zip; private constructor(); /** Create an empty archive for writing. */ static create(): AdmZipArchive; /** Open an existing archive on disk for reading. */ static open(zipPath: string): AdmZipArchive; addFile(absSource: string, archivePath: string): void; addDir(absSourceDir: string, archiveDir: string): void; addBuffer(archivePath: string, data: Buffer): void; write(destPath: string): void; entryPaths(): string[]; readText(archivePath: string): string | undefined; extractDir(archiveDirPrefix: string, destAbsDir: string): number; }