Skip to main content
Module

x/brotli/mod.ts>compress

🗜 Brotli wasm module for deno
Go to Latest
function compress
import { compress } from "https://deno.land/x/brotli@v0.1.4/mod.ts";

Compress a byte array.

import { compress } from "https://deno.land/x/brotli/mod.ts";
const text = new TextEncoder().encode("X".repeat(64));
console.log(text.length);                   // 64 Bytes
console.log(compress(text).length);         // 10 Bytes

Parameters

input: Uint8Array

Input data.

optional
bufferSize: number = [UNSUPPORTED]

Read buffer size

optional
quality: number = [UNSUPPORTED]

Controls the compression-speed vs compression- density tradeoff. The higher the quality, the slower the compression.

optional
lgwin: number = [UNSUPPORTED]

Base 2 logarithm of the sliding window size.

Returns

Uint8Array