compressobj {zlib} | R Documentation |
Create a Compression Object
Description
compressobj
initializes a new compression object with specified parameters
and methods. The function makes use of publicEval
to manage scope and encapsulation.
Usage
compressobj(
level = -1,
method = zlib$DEFLATED,
wbits = zlib$MAX_WBITS,
memLevel = zlib$DEF_MEM_LEVEL,
strategy = zlib$Z_DEFAULT_STRATEGY,
zdict = NULL
)
Arguments
level |
Compression level, default is -1. |
method |
Compression method, default is |
wbits |
Window bits, default is |
memLevel |
Memory level, default is |
strategy |
Compression strategy, default is |
zdict |
Optional predefined compression dictionary as a raw vector. |
Value
Returns an environment containing the public methods compress
and flush
.
Methods
-
compress(data)
: Compresses a chunk of data. -
flush()
: Flushes the compression buffer.
Examples
compressor <- compressobj(level = 6)
compressed_data <- compressor$compress(charToRaw("some data"))
compressed_data <- c(compressed_data, compressor$flush())
[Package zlib version 1.0.3 Index]