Learn R Programming

qs2 (version 0.1.7)

zstd_file_functions: Zstd file helpers

Description

Helpers for compressing and decompressing zstd files.

A utility function to compresses a file with zstd.

A utility function to decompresses a zstd file to disk.

Usage

zstd_compress_file(input_file, output_file, compress_level = qopt("compress_level"))

zstd_decompress_file(input_file, output_file)

Value

No value is returned. The file is written to disk.

No value is returned. The file is written to disk.

Arguments

compress_level

The compression level used.

input_file

Path to the input file.

output_file

Path to the output file.

Examples

Run this code
infile <- tempfile()
writeBin(as.raw(1:5), infile)
outfile <- tempfile()
zstd_compress_file(infile, outfile, compress_level = 1)
stopifnot(file.exists(outfile))
infile <- tempfile()
writeBin(as.raw(1:5), infile)
zfile <- tempfile()
zstd_compress_file(infile, zfile, compress_level = 1)
outfile <- tempfile()
zstd_decompress_file(zfile, outfile)
stopifnot(identical(readBin(infile, what = "raw", n = 5), readBin(outfile, what = "raw", n = 5)))

Run the code above in your browser using DataLab