package brotli

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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 =
  1. | Generic
    (*

    Compression is not aware of any special features of input

    *)
  2. | Text
    (*

    Compression knows that input is UTF-8

    *)
  3. | Font
    (*

    Compression knows that input is WOFF 2.0

    *)
type quality = [
  1. | `_0
  2. | `_1
  3. | `_2
  4. | `_3
  5. | `_4
  6. | `_5
  7. | `_6
  8. | `_7
  9. | `_8
  10. | `_9
  11. | `_10
  12. | `_11
]

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

type lgwin = [
  1. | `_10
  2. | `_11
  3. | `_12
  4. | `_13
  5. | `_14
  6. | `_15
  7. | `_16
  8. | `_17
  9. | `_18
  10. | `_19
  11. | `_20
  12. | `_21
  13. | `_22
  14. | `_23
  15. | `_24
]

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

type lgblock = [
  1. | `_0
  2. | `_16
  3. | `_17
  4. | `_18
  5. | `_19
  6. | `_20
  7. | `_21
  8. | `_22
  9. | `_23
  10. | `_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

OCaml

Innovation. Community. Security.