Download data from an existing release
Usage
pb_download(
file = NULL,
dest = ".",
repo = guess_repo(),
tag = "latest",
overwrite = TRUE,
ignore = "manifest.json",
use_timestamps = TRUE,
show_progress = getOption("piggyback.verbose", default = interactive()),
.token = gh::gh_token()
)
Arguments
- file
character: vector of names of files to be downloaded. If
NULL
, all assets attached to the release will be downloaded.- dest
character: path to destination directory (if length one) or vector of destination filepaths the same length as
file
. Any directories in the path provided must already exist.- repo
string: GH repository name in format "owner/repo". Default
guess_repo()
tries to guess based on current working directory's git repository- tag
string: tag for the GH release, defaults to "latest"
- overwrite
boolean: should any local files of the same name be overwritten? default
TRUE
- ignore
character: vector of files to ignore (used if downloading "all" via
file=NULL
)- use_timestamps
DEPRECATED.
- show_progress
logical, show a progress bar be shown for uploading? Defaults to
interactive()
- can also set globally with options("piggyback.verbose")- .token
GitHub authentication token, see
gh::gh_token()
Examples
# \donttest{
try({
## Download a specific file.
## (if dest is omitted, will write to current directory)
dest <- tempdir()
piggyback::pb_download(
"iris.tsv.gz",
repo = "cboettig/piggyback-tests",
tag = "v0.0.1",
dest = dest
)
list.files(dest)
## Download all files
piggyback::pb_download(
repo = "cboettig/piggyback-tests",
tag = "v0.0.1",
dest = dest
)
list.files(dest)
})
#> [1] "bslib-a655ad9af56d1a84d5022504144f9f41"
#> [2] "diamonds.tsv.gz"
#> [3] "downlit"
#> [4] "file5ae2bb4ecd6"
#> [5] "file5ae2ee5cbd8"
#> [6] "file5ae3e236b0c"
#> [7] "file5ae48477e73"
#> [8] "file5ae4a506215"
#> [9] "file5ae756db147"
#> [10] "iris.tsv.gz"
#> [11] "iris.tsv.xz"
#> [12] "iris2.tsv.gz"
# \dontshow{
try(unlink(list.files(dest, full.names = TRUE)))
# }
# }