/** * Universal decompression utilities for browser and Node.js environments. * * Supports multiple compression formats using fflate: * - gzip (.gz, .gzip) * - ZIP (.zip) * - TAR (.tar) * - Compressed TAR (.tar.gz, .tgz) * * Uses fflate for universal decompression across all environments. * In Node.js, fetched datasets are cached to os.tmpdir() for performance. */ /** * Clear all cached datasets. * * Only works in Node.js environments. No-op in browsers. */ export declare const clearCache: () => Promise; /** * Get cache statistics. * * Returns null in browser environments. */ export declare const getCacheStats: () => Promise<{ count: number; totalBytes: number; } | null>; /** * Detect if a URL points to a gzip-compressed file based on extension. * * @param url - URL to check * @returns True if URL ends with .gz or .gzip (but not .tar.gz or .tgz) */ export declare const isGzipUrl: (url: string) => boolean; /** * Detect if a URL points to a ZIP file based on extension. * * @param url - URL to check * @returns True if URL ends with .zip */ export declare const isZipUrl: (url: string) => boolean; /** * Detect if a URL points to a TAR file based on extension. * * @param url - URL to check * @returns True if URL ends with .tar */ export declare const isTarUrl: (url: string) => boolean; /** * Detect if a URL points to a gzipped TAR file based on extension. * * @param url - URL to check * @returns True if URL ends with .tar.gz or .tgz */ export declare const isTgzUrl: (url: string) => boolean; /** * Decompress gzip-compressed data to a string using fflate. * * @param data - Gzip-compressed data as Uint8Array * @returns Promise resolving to decompressed UTF-8 string */ export declare const decompressGzip: (data: Uint8Array) => Promise; /** * Decompress ZIP data and extract all files. * * Returns a map of filename to content string. * * @param data - ZIP-compressed data as Uint8Array * @returns Promise resolving to map of filename to content */ export declare const decompressZip: (data: Uint8Array) => Promise>; /** * Decompress TAR data and extract all files. * * Parses TAR format (ustar with null-terminated headers). * * @param data - TAR file data as Uint8Array * @returns Promise resolving to map of filename to content */ export declare const decompressTar: (data: Uint8Array) => Promise>; /** * Decompress gzipped TAR data and extract all files. * * @param data - Gzipped TAR file data as Uint8Array * @returns Promise resolving to map of filename to content */ export declare const decompressTgz: (data: Uint8Array) => Promise>; /** * Fetch and decompress gzip content from a URL. * * @param url - URL to fetch gzip-compressed content from * @returns Promise resolving to decompressed UTF-8 string */ export declare const fetchAndDecompressGzip: (url: string) => Promise; /** * Fetch and decompress ZIP content from a URL. * * Returns a map of all files in the ZIP archive. * * @param url - URL to fetch ZIP file from * @returns Promise resolving to map of filename to content */ export declare const fetchAndDecompressZip: (url: string) => Promise>; /** * Fetch and decompress TAR content from a URL. * * Returns a map of all files in the TAR archive. * * @param url - URL to fetch TAR file from * @returns Promise resolving to map of filename to content */ export declare const fetchAndDecompressTar: (url: string) => Promise>; /** * Fetch and decompress gzipped TAR content from a URL. * * Returns a map of all files in the archive. * * @param url - URL to fetch TAR.GZ or .tgz file from * @returns Promise resolving to map of filename to content */ export declare const fetchAndDecompressTgz: (url: string) => Promise>; /** * Detect archive format from URL and fetch with auto-decompression. * * Supports: * - Plain text (no extension) * - Gzip (.gz, .gzip) * - ZIP (.zip) * - TAR (.tar) * - Gzipped TAR (.tar.gz, .tgz) * * For archives (ZIP, TAR, TGZ), returns a map of filename to content. * For single files, returns the content as a string. * * @param url - URL to fetch content from * @returns Promise resolving to either string (single file) or Map (archive) * @throws Error if fetch fails or decompression fails * * @example * ```typescript * // Plain text file * const text1 = await fetchWithAutoDecompress('https://example.com/data.txt'); * // typeof text1 === "string" * * // Gzipped file * const text2 = await fetchWithAutoDecompress('https://example.com/data.txt.gz'); * // typeof text2 === "string" * * // ZIP archive * const files = await fetchWithAutoDecompress('https://example.com/data.zip'); * // files instanceof Map * ``` */ export declare const fetchWithAutoDecompress: (url: string) => Promise>; /** * Fetch content from URL with automatic format detection for archives. * * For archives, extracts and returns the first file with a matching extension. * For single files, returns the content directly. * * @param url - URL to fetch content from * @param preferredExtensions - Array of preferred file extensions to extract from archives (e.g., ['.edges', '.txt']) * @returns Promise resolving to content string * * @example * ```typescript * // Extract first .edges file from ZIP * const edges = await fetchAndExtract('https://example.com/data.zip', ['.edges']); * * // Or just get the content from a plain file * const text = await fetchAndExtract('https://example.com/data.txt'); * ``` */ export declare const fetchAndExtract: (url: string, preferredExtensions?: string[]) => Promise; //# sourceMappingURL=decompress.d.ts.map