Wraps regular download.file, but by default caches the the etag in the file header and then compares this before downloading again.

download.file.wcheck(url, destdir = NULL, destfile = NULL,
  overwrite = NULL, mode = "wb", ...)

Arguments

url

Location of remote file to download

destdir

Path to local download directory

destfile

Full path to local downloaded file

overwrite

Whether to check etag (NULL) or only download if file is missing (FALSE) or always download (TRUE).

mode

See the download.file argument of the same name. Must be set to 'wb' on Windows to download binary files and therefore defaults to this value.

...

Additional arguments passed to download.file

Value

Path to downloaded (or cached) file.

Details

The header will be cached in a file called XXXX.http_header.rds next to the downloaded file.

When the URL is unreachable, a check is made to see if the corresponding file already exists locally. If yes, then a warning is issued, but that path is used. If no, then the function will error out.

The header will be cached in a file called XXXX.http_header.rds next to the downloaded file

See also