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.
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.
from_bigstring ?pos ?len s will pass the content of
pos+len to Zstd functions. This does not incur a copy.