compress_chunk | R Documentation |
Compresses a given chunk of raw binary data using a pre-existing compressor object.
compress_chunk(compressorPtr, input_chunk)
compressorPtr |
An external pointer to an existing compressor object.
This object is usually initialized by calling a different function like |
input_chunk |
A raw vector containing the uncompressed data that needs to be compressed. |
This function is primarily designed for use with a compressor object created by create_compressor()
.
It takes a chunk of raw data and compresses it, returning a raw vector of the compressed data.
A raw vector containing the compressed data.
# Create a new compressor object for zlib -> wbts = 15
zlib_compressor <- create_compressor(wbits=31)
compressed_data <- compress_chunk(zlib_compressor, charToRaw("Hello, World"))
compressed_data <- c(compressed_data, flush_compressor_buffer(zlib_compressor))
decompressed_data <- memDecompress(compressed_data, type = "gzip")
cat(rawToChar(decompressed_data))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.