Skip to contents

Download a public file from an existing download URL.

Usage

cbr_download(
  url_file = NULL,
  dir = getwd(),
  filename = "covidBR",
  keep_filename = FALSE,
  overwrite = TRUE,
  show_progress = getOption("covidBR.verbose", default = interactive())
)

Arguments

url_file

a character string, corresponding the URL to download the public file.

dir

a character string, corresponding the directory where file should be downloaded. By default, the current directory is used (see getwd()).

filename

a character string, corresponding the filename (without the extension) saved on the local disc. By default, covidBR was used as filename.

keep_filename

logical. If TRUE, the name of public file will be used and parameter filename is ignored (default = FALSE).

overwrite

logical. If TRUE, the default, the local file with the same name will be overwritten.

show_progress

logical. If TRUE, the default, shows a progress bar for uploading.

Examples

if (FALSE) {
# Get dowload url (COVID-19 Portal)
download_url <- cbr_dowload_url()

# Save file with default name ('data')
cbr_download(url_file = download_url)

# Save file with name 'my_data'
cbr_download(url_file = download_url, filename = "mydata")

# Save file with default name of COVID-19 Portal
cbr_download(url_file = download_url, keep_filename = TRUE)

# Save file in 'myfolder' folder
cbr_download(url_file = download_url, dir = "./myfolder")

}