Debian Codegraph @

man/curl_download.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/download.R
3 \name{curl_download}
4 \alias{curl_download}
5 \title{Download file to disk}
6 \usage{
7 curl_download(url, destfile, quiet = TRUE, mode = "wb", handle = new_handle())
8 }
9 \arguments{
10 \item{url}{A character string naming the URL of a resource to be downloaded.}
11
12 \item{destfile}{A character string with the name where the downloaded file
13 is saved. Tilde-expansion is performed.}
14
15 \item{quiet}{If \code{TRUE}, suppress status messages (if any), and the
16 progress bar.}
17
18 \item{mode}{A character string specifying the mode with which to write the file.
19 Useful values are \code{"w"}, \code{"wb"} (binary), \code{"a"} (append)
20 and \code{"ab"}.}
21
22 \item{handle}{a curl handle object}
23 }
24 \value{
25 Path of downloaded file (invisibly).
26 }
27 \description{
28 Libcurl implementation of \code{C_download} (the "internal" download method)
29 with added support for https, ftps, gzip, etc. Default behavior is identical
30 to \code{\link[=download.file]{download.file()}}, but request can be fully configured by passing
31 a custom \code{\link[=handle]{handle()}}.
32 }
33 \details{
34 The main difference between \code{curl_download} and \code{curl_fetch_disk}
35 is that \code{curl_download} checks the http status code before starting the
36 download, and raises an error when status is non-successful. The behavior of
37 \code{curl_fetch_disk} on the other hand is to proceed as normal and write
38 the error page to disk in case of a non success response.
39
40 The \code{curl_download} function does support resuming and removes the temporary
41 file if the download did not complete successfully.
42 For a more advanced download interface which supports concurrent requests and
43 resuming large files, have a look at the \link{multi_download} function.
44 }
45 \examples{
46 # Download large file
47 \dontrun{
48 url <- "http://www2.census.gov/acs2011_5yr/pums/csv_pus.zip"
49 tmp <- tempfile()
50 curl_download(url, tmp)
51 }
52 }
53 \seealso{
54 Advanced download interface: \link{multi_download}
55 }