GithubHelp home page GithubHelp logo

tubbz-alt / zip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from r-lib/zip

0.0 0.0 0.0 420 KB

Platform independent zip compression via miniz

License: Other

Makefile 0.02% R 14.23% C 85.76%

zip's Introduction

zip

Cross-Platform โ€˜zipโ€™ Compression

Linux Build Status Windows Build status CRAN RStudio mirror downloads Coverage Status

Installation

install.packages("zip")

Usage

library(zip)

Creating ZIP files

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

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.

zip("sources.zip", c("R", "src"))
file.info("sources.zip")
#>              size isdir mode               mtime               ctime
#> sources.zip 87851 FALSE  644 2019-02-23 22:02:36 2019-02-23 22:02:36
#>                           atime uid gid       uname grname
#> sources.zip 2019-02-23 22:02:36 501  20 gaborcsardi  staff

Directories are added recursively by default.

zip_append() is similar to zip(), but it appends files to an existing ZIP archive.

Listing ZIP files

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

zip_list("sources.zip")
#>                filename compressed_size uncompressed_size
#> 1                    R/               0                 0
#> 2        R/assertions.R             125               296
#> 3           R/process.R            1383              4471
#> 4             R/utils.R             905              3047
#> 5               R/zip.R            2194              6763
#> 6                  src/               0                 0
#> 7            src/init.c             335               762
#> 8    src/install.libs.R             271               576
#> 9          src/Makevars             185               465
#> 10     src/Makevars.win             188               491
#> 11          src/miniz.c           55232            314589
#> 12          src/miniz.h           18113             66863
#> 13           src/rzip.c            2092              6344
#> 14           src/tools/               0                 0
#> 15 src/tools/cmdunzip.c             214               323
#> 16   src/tools/cmdzip.c             909              2599
#> 17            src/zip.c            3169             11295
#> 18            src/zip.h             504              1211
#>              timestamp permissions
#> 1  2019-02-23 22:00:10         755
#> 2  2019-02-22 22:11:46         644
#> 3  2019-02-23 22:00:10         644
#> 4  2019-02-22 22:27:58         644
#> 5  2019-02-23 20:35:36         644
#> 6  2019-02-23 22:02:32         755
#> 7  2019-02-22 22:11:46         644
#> 8  2019-02-23 20:35:36         644
#> 9  2019-02-23 20:35:36         644
#> 10 2019-02-23 20:35:36         644
#> 11 2019-02-23 01:38:12         755
#> 12 2019-02-22 22:11:46         644
#> 13 2019-02-23 20:35:36         644
#> 14 2019-02-23 22:02:32         755
#> 15 2019-02-23 20:35:36         644
#> 16 2019-02-23 20:35:36         644
#> 17 2019-02-23 20:35:36         644
#> 18 2019-02-23 20:35:36         644

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 the zip_process() and unzip_process() functions to create background zip / unzip processes. These processes were implemented on top of the processx::process class, so they are pollable.

License

CC0

zip's People

Contributors

ashesitr avatar batpigandme avatar daattali avatar gaborcsardi avatar jeroen avatar jimhester avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.