gz_functions {RITCH} | R Documentation |
Compresses and uncompresses files to and from gz-archives
Description
Allows the compression and uncompression of files
Usage
gunzip_file(
infile,
outfile = gsub("\\.gz$", "", infile),
buffer_size = min(4 * file.size(infile), 2e+09)
)
gzip_file(
infile,
outfile = NA,
buffer_size = min(4 * file.size(infile), 2e+09)
)
Arguments
infile |
the file to be zipped or unzipped |
outfile |
the resulting zipped or unzipped file |
buffer_size |
the size of the buffer to read in at once, default is 4 times the file.size (max 2Gb). |
Details
Functions are
-
gunzip_file
: uncompresses a gz-archive to raw binary data
-gzip_file
: compresses a raw binary data file to a gz-archive
Value
The filename of the unzipped file, invisibly
Examples
gzfile <- system.file("extdata", "ex20101224.TEST_ITCH_50.gz", package = "RITCH")
file <- system.file("extdata", "ex20101224.TEST_ITCH_50", package = "RITCH")
# uncompress file
(outfile <- gunzip_file(gzfile, "tmp"))
file.info(outfile)
unlink(outfile)
# compress file
(outfile <- gzip_file(file))
file.info(outfile)
unlink(outfile)
[Package RITCH version 0.1.26 Index]