downloader (version 0.4)

download: Download a file, using http, https, or ftp

Description

This is a wrapper for download.file and takes all the same arguments. The only difference is that, if the protocol is https, it changes some settings to make it work. How exactly the settings are changed differs among platforms.

Usage

download(url, ...)

Arguments

url
The URL to download.
...
Other arguments that are passed to download.file.

Details

This function also should follow http redirects on all platforms, which is something that does not happen by default when curl is used, as on Mac OS X.

With Windows, it either uses the "wininet" method (for R 3.2) or uses the "internal" method after first ensuring that setInternet2, is active (which tells R to use the internet2.dll).

On other platforms, it will try to use libcurl, wget, then curl, and then lynx to download the file. R 3.2 will typically have the libcurl method and for previous versions of R Linux platforms will have wget installed, and Mac OS X will have curl.

Note that for many (perhaps most) types of files, you will want to use mode="wb" so that the file is downloaded in binary mode.

See Also

download.file for more information on the arguments that can be used with this function.

Examples

Run this code
## Not run: 
# # Download the downloader source, in binary mode
# download("https://github.com/wch/downloader/zipball/master",
#          "downloader.zip", mode = "wb")
# ## End(Not run)

Run the code above in your browser using DataCamp Workspace