import { type CompressOpts, type InflateOptions, type DeflateOptions, } from '../utils/compression' import { type RawPreload } from '../utils/handlersFiles' export interface CacheEntry { PREFIXUUID: string totalSize: number dataStorage: Uint8Array } /** * CompressionService class handles the compression and decompression of data, * as well as caching the compressed data into files. */ export declare class CompressionService { private cache /** * Extracts a portion of the data to be used as the compression dictionary. * * @param {Uint8Array} data - The data from which the dictionary will be extracted. * @param {1 | 2 | 3 | 4 | null} coverage - Determines the portion of the data to be used as the dictionary. * - `1`, `2`, `3`, `4` represent the percentage of the data that will be used, with 1 being the smallest portion and 4 the largest. * - `null` means no dictionary is extracted, returning an empty Uint8Array. * @returns {Uint8Array} - The extracted portion of the data to be used as a dictionary. */ static extractDictionary( data: Uint8Array, coverage: CompressOpts['coverage'] ): Uint8Array /** * Creates an instance of CompressionService and sets up the cache directory. * * @param {boolean} [useTemp=false] - Whether to use the system's temporary directory for cache. */ constructor(useTemp?: boolean) /** * Returns the generated UUID for cache file names. * * @returns {string} - A UUID string. */ get UUID(): string /** * Returns the directory where the cache files are stored. * * @returns {string} - Cache directory path. */ get cacheDir(): string /** * Compresses the provided data using the given options. * * @param {Uint8Array} data - The data to be compressed. * @param {CompressOpts} options - The compression options, including the dictionary coverage. * @returns {Uint8Array} - The compressed data with a UUID prefix. */ compress(data: Uint8Array, options: CompressOpts): Uint8Array /** * Decompresses the provided compressed data using the given options. * * @param {Uint8Array} data - The compressed data to be decompressed. * @param {InflateOptions} [options] - The decompression options. * @returns {Uint8Array} - The decompressed data. * @throws {Error} - If the prefix does not match the cached dictionary. */ decompress(data: Uint8Array, options?: InflateOptions): Uint8Array /** * Compresses multiple Uint8Array data synchronously using deflate options. * * @param {DeflateOptions} options - The deflate compression options. * @param {...Uint8Array} data - The data chunks to be compressed. * @returns {Uint8Array} - The compressed data. */ compressSync(options?: DeflateOptions, ...data: Uint8Array[]): Uint8Array /** * Decompresses multiple Uint8Array data synchronously using inflate options. * * @param {InflateOptions} options - The inflate decompression options. * @param {Uint8Array} data - The compressed data to be decompressed. * @returns {Uint8Array} - The decompressed data. */ decompressSync( options: InflateOptions | undefined, data: Uint8Array ): Uint8Array /** * Lists all cache files in the current cache directory. * * @returns {string[]} - An array of cache file names. */ listCacheFiles(): string[] /** * Removes a specific cache file by filename. * * @param {string} filename - The name of the cache file to remove. */ removeCacheFile(filename: string): void /** * Clears all cache files from the cache directory. */ clearCache(): void /** * Preloads a single cache file into memory using its prefix. * * @param {string} prefix - The prefix of the cache file. * @param {Map} cache - The cache map to store the loaded file. */ private preloadOneCacheFile /** * Preloads all cache files from the cache directory into memory. * * @param {string} dir - The cache directory to load files from. */ private preloadAllCacheFiles } export type { CompressOpts, InflateOptions, DeflateOptions, RawPreload } //# sourceMappingURL=CompressionService.d.ts.map