compress {zlib} | R Documentation |
Single-step compression of raw data
Description
Compresses the provided raw data in a single step.
Usage
compress(
data,
level = -1,
method = zlib$DEFLATED,
wbits = zlib$MAX_WBITS,
memLevel = zlib$DEF_MEM_LEVEL,
strategy = zlib$Z_DEFAULT_STRATEGY,
zdict = NULL
)
Arguments
data |
Raw data to be compressed. |
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. |
Details
The compress
function simplifies the compression process by encapsulating
the creation of a compression object, compressing the data, and flushing the buffer
all within a single call. This is particularly useful for scenarios where the user
wants to quickly compress data without dealing with the intricacies of compression
objects and buffer management. The function leverages the compressobj
function
to handle the underlying compression mechanics.
Value
A raw vector containing the compressed data.
Examples
compressed_data <- compress(charToRaw("some data"))