UNPKG

1.38 kBTypeScriptView Raw
1/// <reference types="node" />
2import { PassThrough as PassThroughStream } from 'stream';
3export interface BrotliEncodeParams {
4 mode?: number;
5 quality?: number;
6}
7/**
8 * @param incoming Either a Buffer or string of the value to encode.
9 * @param options Subset of Encoding Parameters.
10 * @return Promise that resolves with the encoded Buffer length.
11 */
12export default function size(incoming: Buffer | string, options?: BrotliEncodeParams): Promise<number>;
13/**
14 * @param incoming Either a Buffer or string of the value to encode.
15 * @param options Subset of Encoding Parameters.
16 * @return Length of encoded Buffer.
17 */
18export declare function sync(incoming: Buffer | string, options?: BrotliEncodeParams): number;
19/**
20 * @param options
21 * @return PassThroughStream for the contents being compressed
22 */
23export declare function stream(options?: BrotliEncodeParams): PassThroughStream;
24/**
25 * @param path File Path for the file to compress.
26 * @param options Subset of Encoding Parameters.
27 * @return Promise that resolves with size of encoded file.
28 */
29export declare function file(path: string, options?: BrotliEncodeParams): Promise<number>;
30/**
31 * @param path File Path for the file to compress.
32 * @param options Subset of Encoding Parameters.
33 * @return size of encoded file.
34 */
35export declare function fileSync(path: string, options?: BrotliEncodeParams): number;