import { IncomingHttpEvent } from '../IncomingHttpEvent.js'; import { NextMiddleware, type MetaMiddleware } from '@stone-js/core'; import { OutgoingHttpResponse } from '../OutgoingHttpResponse.js'; /** * Kernel Middleware to compress response content based on the Accept-Encoding header. */ export declare class CompressionMiddleware { /** * Compress the response content based on the Accept-Encoding header. * * @param event - The incoming HTTP event. * @param next - The next middleware in the pipeline. * @returns The outgoing HTTP response. */ handle(event: IncomingHttpEvent, next: NextMiddleware): Promise; /** * Determine the best compression format from the Accept-Encoding header. * * @param event - The incoming HTTP event. * @returns The best compression format to use. */ private getCompressionFormatFromEvent; /** * Compress content using the specified encoding. * * @param content - The content to compress. * @param encoding - The encoding to use (gzip, deflate, br). * @returns The compressed content. */ private compressContent; /** * Check if the content is compressible (string or Buffer). * Only compress Buffer content and string content that is larger than 1KB. * * @param content - The content to check. * @returns True if the content is compressible. */ private isCompressibleContent; } /** * Meta Middleware for compressing response content. */ export declare const MetaCompressionMiddleware: MetaMiddleware;