download_retry: Retry multiple times to download a file

Description Usage Arguments Value Examples

View source: R/download_retry.R

Description

This function is based on the Bioconductor guidelines for querying data from the web at http://bioconductor.org/developers/how-to/web-query/. It will run download a set of N.TRIES times before giving up. We implemented this function to reduce the number of Bioconductor build errors due to the occassional errors from our data hosting server.

Usage

1
download_retry(url, destfile = basename(url), mode = "wb", N.TRIES = 3L, ...)

Arguments

url

The URL to download. Passed to download.

destfile

The destination file. Defaults to the base name of the URL. Passed to download.

mode

Mode for writing the file. The default wb is used for binary files. This value is passed to download which passes it to download.file.

N.TRIES

The number of download attempts before giving up; default: 3. Should be an integer of length one with a value greater than 0.

...

Additional arguments passed to download.

Value

An invisible integer code as specified in download.file.

Examples

1
2
3
4
## Download the first files_info.tsv file (version 1)
download_retry(
    recount_url$url[which(recount_url$file_name == "files_info.tsv")[1]]
)

recount documentation built on Dec. 20, 2020, 2:01 a.m.