| download {TAF} | R Documentation |
Download File
Description
Download a file in binary mode, e.g. a model executable.
Usage
download(url, dir = ".", mode = "wb", chmod = file_ext(url) == "",
destfile = file.path(dir, basename(url)), quiet = TRUE, ...)
Arguments
url |
URL of file to download. |
dir |
directory to download to. |
mode |
download mode, see details. |
chmod |
whether to set execute permission (default is |
destfile |
destination path and filename (optional, overrides
|
quiet |
whether to suppress messages. |
... |
passed to |
Details
With the default mode "wb" the file is downloaded in binary mode (see
download.file), to prevent R from adding ^M at line
ends. This is particularly relevant for Windows model executables, while the
chmod switch is useful when downloading Linux executables.
This function can be convenient for downloading any file, including text
files. Data files in CSV or other text format can also be read directly into
memory using read.table, read.taf or similar functions, without
writing to the file system.
Value
No return value, called for side effects.
Note
If destfile contains a question mark it is removed from the
destfile filename. Similarly, if destfile contains spaces or
‘%20’ sequences, those are converted to underscores.
In general, TAF scripts do not access the internet using
download or similar functions. Instead, data and software are declared
in DATA.bib and SOFTWARE.bib and then downloaded using
taf.boot. The exception is when a boot script is used to fetch
files from a web service (see
TAF Wiki).
See Also
download.file is the underlying base function to download
files.
download.github downloads a GitHub repository.
TAF-package gives an overview of the package.
Examples
## Not run:
url <- paste0("https://github.com/ices-taf/2015_had-iceg/raw/master/",
"bootstrap/initial/software/catageysa/catageysa.exe")
download(url)
## End(Not run)