Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/zipPublic

Platform independent zip compression via miniz

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

r-lib/zip

Repository files navigation

Cross-Platform ‘zip’ Compression

R-CMD-checkCRAN RStudio mirror downloadsCodecov test coverage

Installation

Stable version:

install.packages("zip")

Development version:

pak::pak("r-lib/zip")

Usage

library(zip)

Creating ZIP files

zip() creates a new ZIP archive. (It overwrites the output file if itexists.) Simply supply all directories and files that you want toinclude in the archive.

It makes sense to change to the top-level directory of the files beforearchiving them, so that the files are stored using a relative path name.

zip("sources.zip", c("R","src"))file.info("sources.zip")#>               size isdir mode               mtime               ctime#> sources.zip 603127 FALSE  644 2025-01-07 10:40:54 2025-01-07 10:40:54#>                           atime uid gid       uname grname#> sources.zip 2023-11-03 17:09:37 501  20 gaborcsardi  staff

Directories are added recursively by default.

zip_append() is similar tozip(), but it appends files to anexisting ZIP archive.

Listing ZIP files

zip_list() lists files in a ZIP archive. It returns a data frame:

zip_list("sources.zip")#> # A data frame: 49 × 7#>    filename    compressed_size uncompressed_size timestamp           permissions#>    <chr>                 <dbl>             <dbl> <dttm>              <octmode>#>  1 R/                        0                 0 2025-01-07 09:36:04 755#>  2 R/assertio…             151               398 2023-04-17 10:20:40 644#>  3 R/compat-v…            3333             13294 2025-01-07 09:36:04 644#>  4 R/inflate.R             627              2174 2023-04-17 10:20:40 644#>  5 R/process.R            1793              6585 2023-04-17 10:20:40 644#>  6 R/utils.R              1184              3757 2025-01-07 09:36:50 644#>  7 R/zip-pack…              99               122 2023-11-07 01:18:44 644#>  8 R/zip.R                3290             10384 2025-01-07 09:39:50 644#>  9 src/                      0                 0 2025-01-07 09:01:34 755#> 10 src/init.c              406              1043 2023-11-07 01:18:16 644#> # ℹ 39 more rows#> # ℹ 2 more variables: crc32 <hexmode>, offset <dbl>

Uncompressing ZIP files

unzip() uncompresses a ZIP archive:

exdir<- tempfile()unzip("sources.zip",exdir=exdir)dir(exdir)#> [1] "R"   "src"

Compressing and uncompressing in background processes

You can use thezip_process() andunzip_process() functions tocreate background zip / unzip processes. These processes wereimplemented on top of theprocessx::process class, so they arepollable.

License

MIT

About

Platform independent zip compression via miniz

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors16

Languages


[8]ページ先頭

©2009-2025 Movatter.jp