Bytesrw_zstd
zstd
compressed streams.
This module provides support for reading and writing zstd
compressed streams with the libzstd
C library.
Positions. The positions of readers and writers created by filters of this module default to 0
.
The type for zstd
stream errors.
Except for the library parameters, all functions of this module and resulting reader and writers may raise Bytesrw.Bytes.Stream.Error
with this error.
module Dctx_params : sig ... end
Decompression parameters.
module Ddict : sig ... end
Decompression dictionaries.
val decompress_reads :
?all_frames:bool ->
?dict:Ddict.t ->
?params:Dctx_params.t ->
unit ->
Bytesrw.Bytes.Reader.filter
decompress_reads () r
filters the reads of r
by decompressing zstd
frames. If all_frames
is:
true
(default), this decompressses all frames and concatenates the result, until r
returns Bytes.Slice.eod
.false
this decompresses a single frame. Once the resulting reader returns Bytes.Slice.eod
, r
is positioned exactly after the end of frame and can be used again to perform other non-filtered reads (e.g. a new zstd
frame or other unrelated data).The other parameters are:
dict
is the decompression dictionary, if any.params
defaults to Dctx_params.default
slice_length
defaults to dstream_out_size
.r
and it has no constraints on its own use dstream_in_size
for its slices.val decompress_writes :
?dict:Ddict.t ->
?params:Dctx_params.t ->
unit ->
Bytesrw.Bytes.Writer.filter
decompress_writes () w
filters the writes on w
by decompressing sequences of zstd
frames until Bytes.Slice.eod
is written.
dict
is the decompression dictionary, if any.params
defaults to Dctx_params.default
slice_length
defaults to dstream_in_size
w
's desire but if you get to create it and it has no constraints on its own use dstream_out_size
.module Cctx_params : sig ... end
Compression parameters.
module Cdict : sig ... end
Compression dictionaries.
val compress_reads :
?dict:Cdict.t ->
?params:Cctx_params.t ->
unit ->
Bytesrw.Bytes.Reader.filter
compress_reads () r
filters the reads of r
by compressing them to a single zstd
frame.
dict
is the compression dictionary, if any.params
defaults to Cctx_params.default
.slice_length
defaults to cstream_out_size
.r
and it has no constraints on its own use cstream_in_size
for its slices.val compress_writes :
?dict:Cdict.t ->
?params:Cctx_params.t ->
unit ->
Bytesrw.Bytes.Writer.filter
compress_writes () w
filters the writes on w
by compressing them to a single zstd
frame until Bytes.Slice.eod
is written.
dict
is the compression dictionary, if any.params
defaults to Cctx_params.default
.slice_length
defaults to cstream_in_size
.w
's desire but if you get to create it and it has no constraints on its own use cstream_out_size
.val min_clevel : unit -> Cctx_params.clevel
min_clevel ()
is the minimum negative compression level allowed.
val max_clevel : unit -> Cctx_params.clevel
max_clevel ()
is the maximum compression level available.
val default_clevel : unit -> Cctx_params.clevel
default_clevel ()
is the default compression level.
cstream_in_size ()
is the recommended length of input slices on compression.
cstream_out_size ()
is the recommended length of output slices on compression.
dstream_in_size ()
is the recommended length of input slices on decompression.