package decompress

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

Install

Dune Dependency

Authors

Maintainers

Sources

decompress-1.4.3.tbz
sha256=b22254ae5eb7747452267fc976a3a0ba408c5afdae0896cac4068b4d79ed5a3d
sha512=96f62147f4e0548bb7c4680c4f9d7492a2b4a9e15bc100447b16842e3d1b43ed902fdef03907e1416c174a0586428e515f2deef53ed04098a0443a535938dd6d

doc/decompress.de/De/Inf/index.html

Module De.InfSource

Sourcetype src = [
  1. | `Channel of in_channel
  2. | `String of string
  3. | `Manual
]

The type for input sources. With a `Manual source the client must provide input with src. With `String or `Channel source the client can safely discard `Await case (with assert false).

Sourcetype decode = [
  1. | `Await
  2. | `Flush
  3. | `End
  4. | `Malformed of string
]
Sourcetype decoder

The type for decoders.

Sourceval decoder : src -> o:bigstring -> w:window -> decoder

decoder src ~o ~w is a decoder that inputs from src.

Output buffer.

de uses o buffer as internal buffer to store output. We recommend to allocate an io_buffer_size buffer as output buffer. Then, dst_rem gives you how many bytes it remains in o.

Window.

de needs a window to be able to interpret `Copy code. Length of window is commonly 32k bytes (but the client can use a smaller one with some assumptions).

Sourceval decode : decoder -> decode

decode d is:

  • `Await if d has a `Manual input source and awaits for more input. The client must use src to provide it.
  • `Flush d if given output buffer o (see decoder) is full. The client must use flush to completely flush o. dst_rem gives you how many bytes it remains in o. Inf.dst_rem d - bigstring_length o gives you how many bytes are available.
  • `Malformed err if given input is malformed. err is a human-readable error.
  • `End if given input notify end of flow. o is possibly not empty (it can be check with dst_rem).
Sourceval reset : decoder -> unit

reset d is a decoder as is when it was created by decoder.

Sourceval src : decoder -> bigstring -> int -> int -> unit

src d s j l provides d with l bytes to read, starting at j in s. This byte range is read by calls to decode with d until `Await is returned. To signal the end of input call the function with l = 0.

Sourceval dst_rem : decoder -> int

dst_rem d is how many bytes it remains in given output buffer o.

Sourceval src_rem : decoder -> int

src_rem d is how many bytes it remains in given input buffer.

Sourceval flush : decoder -> unit

flush d provides d with new output storage.

Sourceval checksum : decoder -> optint

checkseum d is ADLER-32 checksum of consumed inputs.

Sourcemodule Ns : sig ... end

A non-streamable implementation of the RFC 1951. It considers the input to be whole and is therefore able to save some time

OCaml

Innovation. Community. Security.