Skip to contents

Download and cache a file

Usage

cacheUrl(url, pkg = "pipette", update = FALSE, ask = FALSE, verbose = TRUE)

Arguments

url

character(1). Uniform Resource Locator (URL).

pkg

character(1). Package name.

update

logical(1). Call bfcneedsupdate internally to see if URL needs an update. Doesn't work reliably for all servers, so disabled by default.

ask

logical(1). Ask if package cache needs to be created or if file needs to be updated.

verbose

logical(1). Run the function with verbose output.

Value

character(1). Cached file path on disk.

Details

Caching requires BiocFileCache and tools packages to be installed. If BiocFileCache is not installed, URL will be downloaded as a temporary file instead.

Note

Updated 2023-09-28.

Examples

url <- AcidBase::pasteUrl(pipetteTestsUrl, "biocfilecache-test.txt")
file <- cacheUrl(url)
print(file)
#> [1] "/Users/mike/.cache/R/pipette/BiocFileCache/1331dac44baa_biocfilecache-test.txt"