Learn R Programming

downloader (version 0.2.1)

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

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 calls setInternet2, which tells R to use the internet2.dll. Then it downloads the file by calling download.file using the "internal" method.

On other platforms, it will try to use wget, then curl, and then lynx to download the file. Typically, 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
# Download the downloader source, in binary mode
download("https://github.com/wch/downloader/zipball/master",
         "downloader.zip", mode = "wb")

Run the code above in your browser using DataLab