package zstandard

  1. Overview
  2. Docs
type t

Zstd exposes multiple API flavors which can be used to transform strings into strings. The t type encodes the various ways to pass a string from the OCaml world to ZStd functions.

val from_string : ?pos:int -> ?len:int -> string -> t

from_string ?pos ?len s will pass the content of s to Zstd functions. This incurs a copy of the OCaml string when from_string is called.

val from_bytes : ?pos:int -> ?len:int -> Core.Bytes.t -> t

from_bytes ?pos ?len s will pass the content of s to Zstd functions. This incurs an allocation of a buffer of size len when calling from_bytes, and a copy of the ocaml bytes each time the resulting t is used by a compression / decompression function.

val from_bigstring : ?pos:int -> ?len:int -> Core.Bigstring.t -> t

from_bigstring ?pos ?len s will pass the content of s between pos and pos+len to Zstd functions. This does not incur a copy.

val from_iobuf : ([> Core.read ], _) Iobuf.t -> t

from_iobuf iobuf will pass the content of iobuf to Zstd functions. This does not incur a copy.