This function copies a remote file to a local cache once and makes sure it is reused.
Usage
.cache_download(
url,
...,
.nocache = getOption("cache.disable", default = FALSE),
.cache = rappdirs::user_cache_dir(utils::packageName()),
.stale = Inf,
.extn = NULL
)Arguments
- url
the url to download
- ...
Named arguments passed on to
utils::download.filemethodMethod to be used for downloading files. Current download methods are
"internal","libcurl","wget","curl"and"wininet"(Windows only), and there is a value"auto": see ‘Details’ and ‘Note’.The method can also be set through the option
"download.file.method": seeoptions().quietIf
TRUE, suppress status messages (if any), and the progress bar.modecharacter. The mode with which to write the file. Useful values are
"w","wb"(binary),"a"(append) and"ab". Not used for methods"wget"and"curl". See also ‘Details’, notably about using"wb"for Windows.cacheOKlogical. Is a server-side cached value acceptable?
extracharacter vector of additional command-line arguments for the
"wget"and"curl"methods.headersnamed character vector of additional HTTP headers to use in HTTP[S] requests. It is ignored for non-HTTP[S] URLs. The
User-Agentheader taken from theHTTPUserAgentoption (seeoptions) is automatically used as the first header....allow additional arguments to be passed, unused.
- .nocache
if set to TRUE all caching is disabled
- .cache
the location of the downloaded files
- .stale
how long to leave this file before replacing it.
- .extn
the file name extension