package bytesrw
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=9d4d65ff080a107f2ed35c4f13ac77c20e4920e92dffe84c270f23169d7db130506a450aa83a6c6c621ce80b699191291fb8be227d1fb47fb5fd49ddc150b37e
doc/bytesrw.zstd/Bytesrw_zstd/index.html
Module Bytesrw_zstdSource
zstd streams (via conf-zstd)
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.
Errors
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.
Decompress
Decompression parameters.
val decompress_reads :
?all_frames:bool ->
?dict:Ddict.t ->
?params:Dctx_params.t ->
unit ->
Bytesrw.Bytes.Reader.filterdecompress_reads () r filters the reads of r by decompressing zstd frames.
dictis the decompression dictionary, if any.paramsdefaults toDctx_params.defaultslice_lengthdefaults todstream_out_size.- If you get to create
rand it has no constraints on its own usedstream_in_sizefor its slices.
If all_frames is:
true(default), this decompressses all frames untilrreturnsBytesrw.Bytes.Slice.eodand concatenates the result.falsethis decompresses a single frame. Once the resulting reader returnsBytesrw.Bytes.Slice.eod,ris positioned exactly after the end of frame and can be used again to perform other non-filtered reads (e.g. a newzstdframe or other unrelated data).
val decompress_writes :
?dict:Ddict.t ->
?params:Dctx_params.t ->
unit ->
Bytesrw.Bytes.Writer.filterdecompress_writes () w ~eod filters the writes on w by decompressing sequences of zstd frames until Bytesrw.Bytes.Slice.eod is written. If eod is false the last Bytesrw.Bytes.Slice.eod is not written on w and at this point w can be used again to perform other non-filtered writes.
dictis the decompression dictionary, if any.paramsdefaults toDctx_params.defaultslice_lengthdefaults todstream_in_size- Compressed slice lengths abides to
w's desire but if you get to create it and it has no constraints on its own usedstream_out_size.
Compress
Warning. The default Cctx_params.default compression parameters are those of the C library and do not perform checksums. If you want to compress so that the zstd command line tool can uncompress you need to checksum. See the example in the quick start.
Compression parameters.
val compress_reads :
?dict:Cdict.t ->
?params:Cctx_params.t ->
unit ->
Bytesrw.Bytes.Reader.filtercompress_reads () r filters the reads of r by compressing them to a single zstd frame.
dictis the compression dictionary, if any.paramsdefaults toCctx_params.default.slice_lengthdefaults tocstream_out_size.- If you get to create
rand it has no constraints on its own usecstream_in_sizefor its slices.
val compress_writes :
?dict:Cdict.t ->
?params:Cctx_params.t ->
unit ->
Bytesrw.Bytes.Writer.filtercompress_writes () w ~eod filters the writes on w by compressing them to a single zstd frame until Bytesrw.Bytes.Slice.eod is written. If eod is false the last Bytesrw.Bytes.Slice.eod is not written on w and at this point w can be used again to perform non-filtered writes.
dictis the compression dictionary, if any.paramsdefaults toCctx_params.default.slice_lengthdefaults tocstream_in_size.- Decompressed slice length abides to
w's desire but if you get to create it and it has no constraints on its own usecstream_out_size.
Library parameters
version () is the version of the libzstd C library.
min_clevel () is the minimum negative compression level allowed.
max_clevel () is the maximum compression level available.
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.
dstream_out_size () is the recommended length of output slices on decompression.