/** Thrown when an archive breaches a safety limit. Callers should answer 400, not 500. */ export declare class UnsafeArchiveError extends Error { constructor(message: string); } /** * Extraction limits. * * What makes 42.zip dangerous is its expansion *ratio*, not its size - so this is a ratio * guard, not a size cap. A fixed byte ceiling has to be either low enough to reject a * legitimate large export or high enough to let a bomb through; no single value does both. * Ratio separates them cleanly: a real export is .axiodb JSON and compresses maybe 5-20:1, * while a bomb needs three orders of magnitude more than that to be worth building. * * A genuine archive therefore imports however large it is, and free disk space - not a * constant picked in advance - is what actually bounds the total. */ export declare const ARCHIVE_LIMITS: { /** * Maximum decompressed:compressed ratio. Gzip's theoretical ceiling is ~1032:1 and bombs * sit at the top of that range; 100:1 leaves real text and JSON an ample margin. */ maxCompressionRatio: number; /** * Ratio is only judged after this much has decompressed. Early in a stream the figure is * meaningless - headers and the first block look extreme on any archive. */ ratioSampleBytes: number; /** Stop before the filesystem does, leaving this much free. */ freeSpaceMarginBytes: number; /** Guards against an archive of millions of tiny files exhausting inodes. */ maxEntries: number; /** Hard ceiling on decompressed bytes. Off by default - disk space is the real bound. */ maxUncompressedBytes: number; }; /** * Compresses a folder into a tar.gz archive. * * @param sourceFolder - The path to the folder to be compressed * @param outPath - The destination path for the compressed archive * @returns A Promise that resolves when compression is complete * * @example * // Compress a folder to a tar.gz file * await tarGzFolder('/path/to/source', '/path/to/archive.tar.gz'); */ export declare function tarGzFolder(sourceFolder: string, outPath: string): Promise; /** * Unzips a .tar.gz file to a specified destination folder * * @param zipFilePath - The path to the compressed file to be unzipped * @param destFolder - The destination folder where the contents will be extracted * @returns A promise that resolves with the destination folder path when unzipping is complete * @throws Will reject the promise with an error if unzipping fails * * @example * ```typescript * try { * const extractedPath = await unzipFile('/path/to/archive.tar.gz', '/path/to/destination'); * console.log(`Files extracted to ${extractedPath}`); * } catch (error) { * console.error('Failed to unzip file:', error); * } * ``` */ export declare function unzipFile(zipFilePath: string, destFolder: string, limits?: Partial): Promise;