package decompress

  1. Overview
  2. Docs
Implementation of Zlib and GZip in OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

decompress-1.6.0.tbz
sha256=aa2e842dc009bcddcbb5c0791f5dbeee2bda5a104ecc7681aa37ac42537e3121
sha512=58e2529fa93f4f671ffd0a69c3542e835868f8c72db9c62b48d207c31f3585101d4d314f7e5922b273c86609b00c87343987b03b568d3e69749d2c7f7fa4089b

doc/decompress.zl/Zl/Def/Ns/index.html

Module Def.NsSource

The type for deflation errors.

Sourceval pp_error : Format.formatter -> error -> unit

Pretty-printer for error.

Sourceval compress_bound : int -> int

compress_bound len returns a clue about how many bytes we need to store the result of the deflation of len bytes. It's a pessimistic calculation.

Sourceval deflate : ?level:int -> bigstring -> bigstring -> (int, [> error ]) result

deflate ~level src dst deflates the content of src into dst.

In case of success, it returns the bytes writen in an Ok result. In case of failure, it returns the error in an Error result. compress_bound can be used to determine how many bytes the user needs to allocate as the destination buffer when he wants to compress N bytes.

Here is an example of how to compress any inputs:

  val input : bigstring

  let len = Zl.Def.Ns.compress_bound (De.bigstring_length input) in
  let dst = De.bigstring_create len in
  Zl.Def.Ns.deflate ~level:4 input dst