@versatiles/container
Version:
A client library for reading VersaTiles containers
14 lines (13 loc) • 1.02 kB
TypeScript
import type { Compression } from './interfaces.js';
/**
* Decompresses a buffer using the specified compression algorithm. Currently supports 'br' for Brotli and 'gzip' for GZIP.
* If the specified algorithm is not supported, the function resolves the promise with the original buffer.
*
* @param {Buffer} buffer - The buffer to be decompressed.
* @param {Compression} compression - The compression algorithm to use. Supported values are 'br' for Brotli and 'gzip' for GZIP.
* @returns {Promise<Buffer>} A promise that, when resolved, provides the decompressed buffer. If the compression type is not recognized,
* the promise will resolve with the original buffer. If decompression fails, the promise will be rejected with an error message.
* @throws {Error} Throws an error if the decompression process encounters an error. The error includes the buffer's length and
* the compression algorithm that was attempted.
*/
export declare function decompress(buffer: Buffer, compression: Compression): Promise<Buffer>;