Compresses srcBuf
into dstBuf
at compression level level
.
dstBuf
must be large enough to fit the entire result. See
compressBound for a way to compute an upper bound on that size.
This ignores any parameters set by setParameter and compresses
at the level specified by level
. See compress2 for a similar
function that respects those parameters.
Wraps ZSTD_compressCCtx
.
Output buffer for compressed bytes
Data to compress
Compression level
Number of compressed bytes written to dstBuf
Compresses srcBuf
into dstBuf
.
Works like compress, except it respects the configuration set on this object with other methods.
Wraps ZSTD_compress2
.
Output buffer for compressed bytes
Data to compress
Number of compressed bytes written to dstBuf
Compresses srcBuf
into dstBuf
with a streaming interface.
The endOp
parameter indicates whether to flush data or end the frame.
May consume all or part of srcBuf
, and may partially write dstBuf
.
Returns a tuple with a bound on how many bytes are left to flush, how many
bytes were written, and how many bytes were consumed.
Wraps ZSTD_compressStream2
.
Output buffer for compressed bytes
Data to compress
Whether to flush or end the frame
Compression progress information
This function requires some care to use correctly, consult the Zstandard manual for full usage information.
Compresses srcBuf
into dstBuf
using the prepared dictionary dict
.
Works like compress, except it uses a dictionary. The compression level is selected at dictionary load time.
Wraps ZSTD_compress_usingCDict
.
Output buffer for compressed bytes
Data to compress
Prepared dictionary
Number of compressed bytes written to dstBuf
Compresses srcBuf
into dstBuf
, using dictBuf
as a dictionary.
Works like compress, except it uses a dictionary.
Wraps ZSTD_compress_usingDict
.
Output buffer for compressed bytes
Data to compress
Compression dictionary
Compression level
Number of compressed bytes written to dstBuf
Loading the dictionary from a buffer is expensive. If the dictionary will be used more than once, it's better to load it into a CDict once and use compressUsingCDict instead.
Load a compression dictionary from dictBuf
.
Note that this dictionary will only be used by the compress2 and compressStream2 methods.
Wraps ZSTD_CCtx_loadDictionary
.
Resets this compression context.
The reset
parameter controls what exactly is reset.
Wraps ZSTD_CCtx_reset
.
Set a compression parameter.
Note that these parameters are only respected by the compress2 and compressStream2 methods.
Wraps ZSTD_CCtx_setParameter
.
Parameter to set
New parameter value
Set the uncompressed length of the next frame.
Allows populating the header with the uncompressed size when using the streaming compression interface. Compression will throw an error if this commitment is not respected.
Wraps ZSTD_CCtx_setPledgedSrcSize
.
Compression context.
Wraps
ZSTD_CCtx
(which is alsoZSTD_CStream
). The finalizer automatically callsZSTD_freeCCtx
when this object is garbage collected.