download_file function

Download File from the Internet

Download File from the Internet

Download a file from the Internet and save to a cache directory.

download_file(url, cachedir = get_cache_dir(), ..., quiet = FALSE, mode = "wb")

Arguments

  • url: 'character' string. URL of a resource to be downloaded.
  • cachedir: 'character' string. Path to the cache directory, see get_cache_dir function for the default value. The file will not be downloaded if the file exists in the cache directory.
  • ...: Additioanl arguments to be passed to the download.file function. The destination of the downloaded file may not be specified.
  • quiet: 'logical' flag. Whether to supress status messages (if any), and the progress bar.
  • mode: 'character' string. Mode with which to write the file. Useful values are "w", "wb" (binary), "a" (append) and "ab".

Returns

Returns the path to the downloaded file, or extracted files when decompression occurs.

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center