| zstd_file_functions | R Documentation |
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.
zstd_compress_file(input_file, output_file, compress_level = qopt("compress_level"))
zstd_decompress_file(input_file, output_file, max_output_bytes = NULL)
compress_level |
The compression level used. |
input_file |
Path to the input file. |
output_file |
Path to the output file. |
max_output_bytes |
Optional maximum number of decompressed output bytes. When supplied, decompression stops with an error before writing a chunk that would exceed this limit. |
No value is returned. The file is written to disk.
No value is returned. The file is written to disk.
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.