Module Brotli.Compress

Provides functions for compression using the Brotli algorithm with adjustable parameters, defaults are what Google uses. Be aware that compression may raise Failure exception

val version : string

Brotli encoder version

type mode =
| Generic

(** Compression is not aware of any special features of input *)

| Text

(** Compression knows that input is UTF-8 *)

| Font

(** Compression knows that input is WOFF 2.0 *)

type quality = [
| `_0
| `_1
| `_2
| `_3
| `_4
| `_5
| `_6
| `_7
| `_8
| `_9
| `_10
| `_11
]

Controls the compression-speed vs compression-density tradeoffs. The higher the quality, the slower the compression. Range is `_0 to `_11.

type lgwin = [
| `_10
| `_11
| `_12
| `_13
| `_14
| `_15
| `_16
| `_17
| `_18
| `_19
| `_20
| `_21
| `_22
| `_23
| `_24
]

Base 2 logarithm of the sliding window size. Range is `_10 to `_24.

type lgblock = [
| `_0
| `_16
| `_17
| `_18
| `_19
| `_20
| `_21
| `_22
| `_23
| `_24
]

Base 2 logarithm of the maximum input block size. Range is `_16 to `_24. If set to `_0, the value will be set based on the quality.

val bytes : ?⁠mode:mode ‑> ?⁠quality:quality ‑> ?⁠lgwin:lgwin ‑> ?⁠lgblock:lgblock ‑> ?⁠on_part_compressed:(Nativeint.t ‑> unit) ‑> bytes ‑> bytes

Compress the given bytes string to a compressed bytes string

val file : ?⁠mode:mode ‑> ?⁠quality:quality ‑> ?⁠lgwin:lgwin ‑> ?⁠lgblock:lgblock ‑> ?⁠on_part_compressed:(Nativeint.t ‑> unit) ‑> in_filename:string ‑> out_filename:string ‑> unit ‑> unit

Compress in the input file to the output file name