/** * Archive module error types. * * All archive-related errors extend ArchiveError. */ import { BaseError, type BaseErrorOptions } from "../../../utils/errors.js"; export { AbortError, createAbortError, isAbortError, throwIfAborted, createLinkedAbortController, toError, suppressUnhandledRejection, errorToJSON, getErrorChain, getRootCause, type BaseErrorOptions } from "../../../utils/errors.js"; /** * Base class for all archive-related errors. */ export declare class ArchiveError extends BaseError { constructor(message: string, options?: BaseErrorOptions); } /** * Check if an error is an archive error. */ export declare function isArchiveError(err: unknown): err is ArchiveError; /** * Error thrown when ZIP parsing fails. */ export declare class ZipParseError extends ArchiveError { name: string; } /** * Error thrown when an invalid ZIP signature is encountered. */ export declare class InvalidZipSignatureError extends ZipParseError { name: string; constructor(expected: string, actual: number, context?: string); } /** * Error thrown when End of Central Directory is not found. */ export declare class EocdNotFoundError extends ZipParseError { name: string; constructor(); } /** * Error thrown when CRC32 validation fails. */ export declare class Crc32MismatchError extends ArchiveError { readonly path: string; readonly expected: number; readonly actual: number; name: string; constructor(path: string, expected: number, actual: number); } /** * Reason for entry size mismatch. * - `too-many-bytes`: ZIP bomb detected - actual size exceeds declared size * - `too-few-bytes`: Corruption detected - actual size is less than declared size */ export type EntrySizeMismatchReason = "too-many-bytes" | "too-few-bytes"; /** * Error thrown when the actual decompressed size doesn't match the declared size. * This is a security feature to detect ZIP bombs and corrupted archives. */ export declare class EntrySizeMismatchError extends ArchiveError { readonly path: string; readonly expected: number; readonly actual: number; readonly reason: EntrySizeMismatchReason; name: string; constructor(path: string, expected: number, actual: number, reason: EntrySizeMismatchReason); /** * Check if this error indicates a potential ZIP bomb (too many bytes). */ isZipBomb(): boolean; /** * Check if this error indicates data corruption (too few bytes). */ isCorruption(): boolean; } /** * Error thrown when decryption fails (wrong password or corrupted data). */ export declare class DecryptionError extends ArchiveError { name: string; constructor(path: string, details?: string); } /** * Error thrown when a password is required but not provided. */ export declare class PasswordRequiredError extends ArchiveError { name: string; constructor(path: string); } /** * Error thrown when the server doesn't support Range requests. */ export declare class RangeNotSupportedError extends ArchiveError { name: string; constructor(url: string); } /** * Error thrown when an HTTP request fails. */ export declare class HttpRangeError extends ArchiveError { readonly url: string; readonly status: number; readonly statusText: string; name: string; constructor(url: string, status: number, statusText: string); } /** * Error thrown when a file is too large for in-memory extraction. */ export declare class FileTooLargeError extends ArchiveError { name: string; constructor(path: string, reason: string); } /** * Error thrown when an unsupported compression method is encountered. */ export declare class UnsupportedCompressionError extends ArchiveError { name: string; constructor(method: number); }