Learn R Programming

httpcache (version 1.0.2)

cachedDownload: Cache the result of a file download

Description

This function wraps utils::download.file(). When caching is enabled, cachedDownload will save a copy of the resulting file to temporary storage and record that location in the query cache. Subsequent download requests will just copy the cached file to the destination path and not make a request across the network.

Usage

cachedDownload(url, destfile, ...)

Arguments

url

character URL to download

destfile

character file path/name where the download should be saved

...

additional arguments, ultimately passed to download.file

Value

From utils::download.file(): "An (invisible) integer code, 0 for success and non-zero for failure. For the "wget" and "curl" methods this is the status code returned by the external program. The "internal" method can return 1, but will in most cases throw an error."