library(knitr) knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) if (!interactive()) { options(width = 99) }
The goal of zippr is to provide an alternative to the zip package built on miniz, a cross-platform, lossless, high performance data compression library. The exact functionality of this package is still extremely fluid.
Three main types of changes are being made:
zip_*
to avoid masking
utils::zip()
and utils::unzip()
. Match to names like fs::dir_info()
.%>%
.You can install the development version of zippr from GitHub with:
# install.packages("remotes") remotes::install_github("kiernann/zippr")
Install the release version of zip from CRAN if needed.
install.packages("zip")
library(magrittr) library(zippr) library(fs)
zip_create()
takes uncompressed files and creates a compressed ZIP archive.
Simply supply all directories and files that you want to include in the archive.
Arguments have been arranged to accept piped paths.
It makes sense to change to the top-level directory of the files before archiving them, so that the files are stored using a relative path name.
tmp <- dir_ls("R") %>% # pipe paths into zip zip_create("sources.zip")
file_info(tmp)[, 1:5]
Directories are added recursively by default.
zip_append()
is similar to zip_create()
, but it appends files to an existing
ZIP archive.
zip_info()
lists files in a ZIP archive. It returns a data frame with
human-readable fs columns.
zip_info(tmp)
To get just the file names, use zip_ls()
. To get file sizes, use zip_size().
zip_ls(tmp) zip_size(tmp)
zip_extract()
uncompresses a ZIP archive to a given directory.
out <- zip_extract( zipfile = tmp, exdir = tempdir(), junk_paths = TRUE, ) file_info(out)[, 1:5]
file_delete(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.