Debian Codegraph @

man/download_file.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/io.R
3 \name{download_file}
4 \alias{download_file}
5 \title{Try various methods to download a file}
6 \usage{
7 download_file(
8 url,
9 output = url_filename(url),
10 ...,
11 .error = "No download method works (auto/wininet/wget/curl/lynx)"
12 )
13 }
14 \arguments{
15 \item{url}{The URL of the file.}
16
17 \item{output}{Path to the output file. By default, it is determined by
18 \code{\link[=url_filename]{url_filename()}}.}
19
20 \item{...}{Other arguments to be passed to \code{\link[=download.file]{download.file()}} (except
21 \code{method}).}
22
23 \item{.error}{An error message to signal when the download fails.}
24 }
25 \value{
26 The \code{output} file path if the download succeeded, or an error if none
27 of the download methods worked.
28 }
29 \description{
30 Try all possible methods in \code{\link[=download.file]{download.file()}} (e.g., \code{libcurl}, \code{curl},
31 \code{wget}, and \code{wininet}) and see if any method can succeed. The reason to
32 enumerate all methods is that sometimes the default method does not work,
33 e.g., \url{https://stat.ethz.ch/pipermail/r-devel/2016-June/072852.html}.
34 }
35 \note{
36 To allow downloading large files, the \code{timeout} option in \code{\link[=options]{options()}}
37 will be temporarily set to one hour (3600 seconds) inside this function
38 when this option has the default value of 60 seconds. If you want a
39 different \code{timeout} value, you may set it via \code{options(timeout = N)}, where
40 \code{N} is the number of seconds (not 60).
41 }