gzip
From R.utils v1.5.8
by Henrik Bengtsson
Gzip/Gunzip a file
Gzip/Gunzip a file.
- Keywords
- file, programming
Usage
## S3 method for class 'default':
gzip(filename, destname=sprintf("\%s.gz", filename), overwrite=FALSE, remove=TRUE, BFR.SIZE=1e+07, ...)
Arguments
- filename
- Pathname of input file.
- destname
- Pathname of output file.
- overwrite
- If the output file already exists, then if
overwrite
isTRUE
the file is silently overwritting, otherwise an exception is thrown. - remove
- If
TRUE
, the input file is removed afterward, otherwise not. - BFR.SIZE
- The number of bytes read in each chunk.
- ...
- Not used.
Details
Internally gzfile()
(see connections
) is used to
read (write) chunks to (from) the gzip file.
If the process is interrupted before completed, the partially written
output file is automatically removed.
Value
- Returns the number of (input) bytes read.
Examples
cat(file="foo.txt", "Hello world!")
gzip("foo.txt")
print(file.info("foo.txt.gz"))
gunzip("foo.txt.gz")
print(file.info("foo.txt"))
file.remove("foo.txt")
Community examples
Looks like there are no examples yet.