Download data from an existing release

pb_download(file = NULL, dest = usethis::proj_get(),
  repo = guess_repo(), tag = "latest", overwrite = TRUE,
  ignore = "manifest.json", use_timestamps = TRUE,
  show_progress = TRUE, .token = get_token())

Arguments

file

name or vector of names of files to be downloaded. If NULL, all assets attached to the release will be downloaded.

dest

name of vector of names of where file should be downloaded. Should be a directory or a list of filenames the same length as file vector. Can include paths to files, but any directories in that path must already exist.

repo

Repository name in format "owner/repo". Will guess the current repo if not specified.

tag

tag for the GitHub release to which this data is attached

overwrite

Should any local files of the same name be overwritten? default TRUE.

ignore

a list of files to ignore (if downloading "all" because file=NULL).

use_timestamps

If TRUE, then files will only be downloaded if timestamp on GitHub is newer than the local timestamp (if overwrite=TRUE). Defaults to TRUE.

show_progress

logical, should we show progress bar for download? Defaults to TRUE.

.token

GitHub authentication token. Typically set from an environmental variable, e.g. in a .Renviron file or with Sys.setenv(GITHUB_TOKEN = "xxxxx"), which helps prevent accidental disclosure of a secret token when sharing scripts.

Examples

## Download a specific file. ## (dest can be omitted when run inside and R project) piggyback::pb_download("data/iris.tsv.gz", repo = "cboettig/piggyback-tests", dest = tempdir())
#> Warning: file(s) data/iris.tsv.gz not found in repo cboettig/piggyback-tests
#> All files up-to-date already
# NOT RUN { ## Download all files piggyback::pb_download(repo = "cboettig/piggyback-tests", dest = tempdir()) # }