package zstandard

  1. Overview
  2. Docs
type t
val create : int -> t
val compress : t -> inbuf:Core.Bigstring.t -> inpos:int -> inlen:int -> outbuf:Core.Bigstring.t -> outpos:int -> outlen:int -> int * int
val flush : t -> outbuf:Core.Bigstring.t -> outpos:int -> outlen:int -> int * int

Attempts to flush the contents of the internal buffers of t. If the output size is too small, a single invocation of the function might not be sufficient to flush the buffer.

val endstream : t -> outbuf:Core.Bigstring.t -> outpos:int -> outlen:int -> int * int

Performs a flush and write an epilogue for the stream. The epilogue is required for decoders to consider the message complete.

val free : t -> unit

free t deallocate the underlying datastructure. Subsequent uses of t will cause exceptions.

The recommended length for inbuf. Other sizes will work fine, but zstd compresses a single block all at once instead of incrementally, so providing less data than this will result in the data being stored inside t until enough data is provided or flush is called

The recommended length for outbuf. This is guaranteed to be enough to store any single compressed block. As, other sizes will work fine, but smaller sizes may result in multiple calls to compress or flush than necessary, and larger buffers will use more memory.

OCaml

Innovation. Community. Security.