Package zip. R topics documented: March 11, Title Cross-Platform 'zip' Compression Version 2.0.1

Similar documents
Package spark. July 21, 2017

Package sessioninfo. June 21, 2017

Package filelock. R topics documented: February 7, 2018

Package rcmdcheck. R topics documented: November 10, 2018

Package goodpractice

Package sankey. R topics documented: October 22, 2017

Package rhub. November 1, 2017

Package desc. May 1, 2018

Package fastdummies. January 8, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package pkgbuild. October 16, 2018

Package callr. August 29, 2016

Package knitrprogressbar

Package available. November 17, 2017

Package remotes. December 21, 2017

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package messaging. May 27, 2018

Package datasets.load

Package cli. November 5, 2017

Package librarian. R topics documented:

Package ezknitr. September 16, 2016

Package kirby21.base

Package callr. January 30, 2018

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package validara. October 19, 2017

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package gifti. February 1, 2018

Package crossword.r. January 19, 2018

Package fastqcr. April 11, 2017

Package spelling. December 18, 2017

Package ECctmc. May 1, 2018

Package algorithmia. September 13, 2016

Package robotstxt. November 12, 2017

Package repec. August 31, 2018

Package styler. December 11, Title Non-Invasive Pretty Printing of R Code Version 1.0.0

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package geogrid. August 19, 2018

Package radix. September 17, 2018

Package pkgload. July 8, 2018

Package io. January 15, 2018

Package slickr. March 6, 2018

Package internetarchive

Package clipr. June 23, 2018

Package fst. December 18, 2017

Package getopt. February 16, 2018

Package canvasxpress

Package loggit. April 9, 2018

R topics documented: 2 checkpoint-package

Package sfdct. August 29, 2017

Package rmatio. July 28, 2017

Package jstree. October 24, 2017

Package dbx. July 5, 2018

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package essurvey. August 23, 2018

Package lvec. May 24, 2018

Package kdtools. April 26, 2018

Package tensorflow. January 17, 2018

Package rbraries. April 18, 2018

Package utilsipea. November 13, 2017

Package Rserve. R topics documented: February 19, Version Title Binary R server

Package tidyselect. October 11, 2018

Package rtika. May 2, 2018

Package strat. November 23, 2016

Package googlecloudstorager

Package cloudml. June 12, 2018

Package githubinstall

Package keyholder. May 19, 2018

Package tidytransit. March 4, 2019

Package mdftracks. February 6, 2017

Package exifr. October 15, 2017

Package projector. February 27, 2018

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package utf8. May 24, 2018

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package postal. July 27, 2018

Package pdfsearch. July 10, 2018

Package rngtools. May 15, 2018

Package rsppfp. November 20, 2018

Package testit. R topics documented: June 14, 2018

Package gtrendsr. October 19, 2017

Package stapler. November 27, 2017

Package farver. November 20, 2018

Package postgistools

Package barcoder. October 26, 2018

Package deductive. June 2, 2017

Package lumberjack. R topics documented: July 20, 2018

Package gtrendsr. August 4, 2018

Package docxtools. July 6, 2018

Package condusco. November 8, 2017

Package WordR. September 7, 2017

Package facerec. May 14, 2018

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package darksky. September 20, 2017

Package tiler. June 9, 2018

Package shinytest. May 7, 2018

Package regexselect. R topics documented: September 22, Version Date Title Regular Expressions in 'shiny' Select Lists

Package catchr. R topics documented: December 30, Type Package. Title Catch, Collect, and Raise Conditions. Version 0.1.0

R topics documented: 2 clone

Package calpassapi. August 25, 2018

Transcription:

Title Cross-Platform 'zip' Compression Version 2.0.1 Package zip March 11, 2019 Author Gábor Csárdi, Kuba Podgórski, Rich Geldreich Maintainer Gábor Csárdi <csardi.gabor@gmail.com> Cross-Platform 'zip' Compression Library. A replacement for the 'zip' function, that does not require any additional external tools on any platform. License CC0 LazyData true URL https://github.com/r-lib/zip#readme BugReports https://github.com/r-lib/zip/issues RoxygenNote 6.1.1 Suggests covr, processx, R6, testthat, withr Encoding UTF-8 NeedsCompilation yes Repository CRAN Date/Publication 2019-03-11 18:20:03 UTC R topics documented: unzip............................................ 2 unzip_process........................................ 3 zip.............................................. 3 zip_list............................................ 6 zip_process......................................... 6 Index 8 1

2 unzip unzip Uncompress zip Archives unzip() always restores modification times of the extracted files and directories. unzip(zipfile, files = NULL, overwrite = TRUE, junkpaths = FALSE, exdir = ".") Arguments zipfile files overwrite junkpaths exdir Path to the zip file to uncompress. Character vector of files to extract from the archive. Files within directories can be specified, but they must use a forward slash as path separator, as this is what zip files use internally. If NULL, all files will be extracted. Whether to overwrite existing files. If FALSE and a file already exists, then an error is thrown. Whether to ignore all directory paths when creating files. If TRUE, all files will be created in exdir. Directory to uncompress the archive to. If it does not exist, it will be created. Permissions If the zip archive stores permissions and was created on Unix, the permissions will be restored. Examples ## Some files to zip up dir.create(tmp <- tempfile()) cat("first file", file = file.path(tmp, "file1")) cat("second file", file = file.path(tmp, "file2")) zipfile <- tempfile(fileext = ".zip") zipr(zipfile, tmp) ## List contents ## Extract tmp2 <- tempfile() unzip(zipfile, exdir = tmp2)

unzip_process 3 unzip_process Class for an external unzip process unzip_process() returns an R6 class that represents an unzip process. It is implemented as a subclass of processx::process. unzip_process() Value An unzip_process R6 class object, a subclass of processx::process. Using the unzip_process class up <- unzip_process()$new(zipfile, exdir = ".") See processx::process for the class methods. Arguments: zipfile: Path to the zip file to uncompress. exdir: Directory to uncompress the archive to. If it does not exist, it will be created. Examples ex <- system.file("example.zip", package = "zip") tmp <- tempfile() up <- unzip_process()$new(ex, exdir = tmp) up$wait() up$get_exit_status() dir(tmp) zip Compress Files into zip Archives zipr and zip both create a new zip archive file.

4 zip zip(zipfile, files, recurse = TRUE, compression_level = 9) zipr(zipfile, files, recurse = TRUE, compression_level = 9) zip_append(zipfile, files, recurse = TRUE, compression_level = 9) zipr_append(zipfile, files, recurse = TRUE, compression_level = 9) Arguments Details Value zipfile files The zip file to create. If the file exists, zip overwrites it, but zip_append appends to it. List of file to add to the archive. See details below about absolute and relative path names. recurse Whether to add the contents of directories recursively. compression_level A number between 1 and 9. 9 compresses best, but it also takes the longest. zipr_append and zip_append append compressed files to an existing zip file. The name of the created zip file, invisibly. Permissions zipr() (and zip(), zipr_append(), etc.) add the permissions of the archived files and directories to the ZIP archive, on Unix systems. Most zip and unzip implementations support these, so they will be recovered after extracting the archive. Note, however that the owner and group (uid and gid) are currently omitted, even on Unix. Relative paths The different between zipr and zip is how they handle the relative paths of the input files. For zip (and zip_append), the root of the archive is supposed to be the current working directory. The paths of the files are fully kept in the archive. Absolute paths are also kept. Note that this might result non-portable archives: some zip tools do not handle zip archives that contain absolute file names, or file names that start with..// or./. This behavior is kept for compatibility, and we suggest that you use zipr and zipr_append for new code. E.g. for the following directory structure: foo bar file1

zip 5 bar2 file2 foo2 file3 Assuming the current working directory is foo, the following zip entries are created by zip: zip("x.zip", c("bar/file1", "bar2", "../foo2")) zip_list("x.zip")$filename #> bar/file1 #> bar2 #> bar2/file2 #>../foo2 #>../foo2/file3 For zipr (and zipr_append), each specified file or directory in files is created as a top-level entry in the zip archive. We suggest that you use zip and zip_append for new code, as they don t create non-portable archives. For the same directory structure, these zip entries are created: zipr("x.zip", c("bar/file1", "bar2", "../foo2")) zip_list("x.zip")$filename #> file1 #> bar2 #> bar2/file2 #> foo2 #> foo2/file3 Examples ## Some files to zip up dir.create(tmp <- tempfile()) cat("first file", file = file.path(tmp, "file1")) cat("second file", file = file.path(tmp, "file2")) zipfile <- tempfile(fileext = ".zip") zipr(zipfile, tmp) ## List contents ## Add another file cat("third file", file = file.path(tmp, "file3")) zipr_append(zipfile, file.path(tmp, "file3"))

6 zip_process zip_list List Files in a zip Archive List Files in a zip Archive Arguments zipfile Path to an existing ZIP file. Value A data frame with columns: filename, compressed_size, uncompressed_size, timestamp, permissions. zip_process Class for an external zip process Value zip_process() returns an R6 class that represents a zip process. It is implemented as a subclass of processx::process. zip_process() A zip_process R6 class object, a subclass of processx::process. Using the zip_process class zp <- zip_process()$new(zipfile, files, recurse = TRUE) See processx::process for the class methods. Arguments: zipfile: Path to the zip file to create. files: List of file to add to the archive. Each specified file or directory in is created as a top-level entry in the zip archive. recurse Whether to add the contents of directories recursively.

zip_process 7 Examples dir.create(tmp <- tempfile()) write.table(iris, file = file.path(tmp, "iris.ssv")) zipfile <- tempfile(fileext = ".zip") zp <- zip_process()$new(zipfile, tmp) zp$wait() zp$get_exit_status()

Index processx::process, 3, 6 unzip, 2 unzip_process, 3 zip, 3 zip_append (zip), 3 zip_list, 6 zip_process, 6 zipr (zip), 3 zipr_append (zip), 3 8