zuarchive is an R package that reads and writes ZIP and tar archives, and reads Compound Files (“OLE2”), member by member, from a path or from bytes in memory.
- Every input is treated as hostile: member counts, sizes, total output and compression ratios are bounded by limits you set, and extraction never writes outside its target directory.
- The format is found from the bytes, and a tar inside gzip, zstd or lz4 reads like a plain one.
- Writing is reproducible: the same files give the same bytes on every platform.
- A C interface and a static library let other packages link the readers without loading zuarchive.
Installation
Install the released version from CRAN:
install.packages("zuarchive")Or the development version from GitHub:
# install.packages("pak")
pak::pak("pedrobtz/zuarchive")Usage
archive_read() returns one member of an archive, here as text, without extracting anything to disk:
library(zuarchive)
z <- archive_open(system.file("extdata", "hello.zip", package = "zuarchive"))
archive_read(z, "hello.txt", as = "text")
#> [1] "hello"zuarchive also lists, streams, extracts and writes archives; Get started shows how.
Learn more
- Get started: open, list, read, extract and write ZIP and tar archives, and what a refusal looks like.
- Reference: every function, its limits and the conditions it raises.
zuarchive takes miniz and its codecs from zukomp, linked statically.