Skip to contents

Download a file from the Internet

Usage

download(url, destfile, quiet = FALSE, ...)

Arguments

url

character(1). URL.

destfile

character(1). Destination file.

quiet

logical(1). Suppress status messages.

...

Passthrough arguments to utils::download.file().

Value

character(1). Destination file path. Note that this differs from download.file, which returns a status code (e.g. 0 for success) instead.

Details

Unlike utils::download.file(), intentionally errors on any download failure. Automatically sets a long time out internally via options(timeout = 9999L), to avoid download issues related to timeout configuration in Rprofile.

Note

Updated 2023-01-30.

Examples

url <- "https://bioconductor.org/bioc-version"
destfile <- "bioc-version.txt"
out <- download(url = url, destfile = destfile, quiet = TRUE)
print(out)
#> [1] "bioc-version.txt"
file.remove(out)
#> [1] TRUE