deflate_decompress: Decompress a raw vector with libdeflate

View source: R/api.R

deflate_decompressR Documentation

Decompress a raw vector with libdeflate

Description

Decompress a raw DEFLATE stream to its original length.

Usage

deflate_decompress(decompressor, input, out_len)

Arguments

decompressor

An external pointer created by 'alloc_decompressor()'.

input

A raw vector containing the compressed DEFLATE stream.

out_len

Integer giving the expected uncompressed length (in bytes).

Value

A raw vector of length 'out_len' containing the decompressed data.

Examples

# round-trip example
msg = "Round-trip test: 123123123123"
raw_in = charToRaw(msg)
cmp = alloc_compressor(12L)
raw_cmp = deflate_compress(cmp, raw_in)
dcmp = alloc_decompressor()
raw_out = deflate_decompress(dcmp, raw_cmp, length(raw_in))
stopifnot(identical(raw_out, raw_in))

libdeflate documentation built on June 29, 2025, 5:07 p.m.