Skip to content

Commit

Permalink
Merge pull request #377 from kimsjune/add_archive_support
Browse files Browse the repository at this point in the history
Add archive support
  • Loading branch information
stevenolen authored May 21, 2024
2 parents 7e524ad + 5ad2a96 commit 896c68c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/archive/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -x
set -e

apt-get update -qq
apt-get install libarchive-dev

26 changes: 26 additions & 0 deletions packages/archive/test.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
options(download.file.method="curl")
install.packages("archive", repos = "https://cran.rstudio.com")
library(archive)


## https://archive.r-lib.org/reference/archive_write_files.html

# write some files to a directory
d <- tempfile()
dir.create(d)
old <- setwd(d)

write.csv(iris, file.path(d, "iris.csv"))
write.csv(mtcars, file.path(d, "mtcars.csv"))
write.csv(airquality, file.path(d, "airquality.csv"))

# Add some to a new archive
a <- archive_write_files("data.tar.gz", c("iris.csv", "mtcars.csv"))
setwd(old)
a

# Add all files in a directory
a <- archive_write_dir("data.zip", d)
a

unlink("data.zip")

0 comments on commit 896c68c

Please sign in to comment.