If the row has a checksum (checksum and checksum_algorithm; MD5, SHA-1 or SHA-256), the
file is checked against it. On a mismatch the file is deleted and an error is raised;
verify = FALSE skips the check. byte_size is not checked: on the portal it is often a
placeholder (0, 1, 1024).
Arguments
- x
A URL, or a one-row data frame from
de_distributions().- dest
A file path, or an existing directory to save the file in under its own name. Required: nothing is written to the working directory unless you pass it (e.g.
".").- verify
Check the file against the row's checksum, if it has one.
- resume
Continue an interrupted download of the same URL to the same place.
- max_bytes
Stop a download that is (or is announced as) larger than this, delete the partial file and raise an error. Default: no limit.
Details
The file is written as <file>.part and renamed when complete. If a download is interrupted,
calling de_download() again for the same URL and destination continues where it stopped, when
the server supports ranges and identifies the file (ETag or Last-Modified); a file that changed
meanwhile is downloaded again from the start. resume = FALSE always starts from the start.
Examples
if (FALSE) { # interactive()
files <- de_distributions("6689f1686e4bd9bc98ed011b", files_only = TRUE)
path <- de_download(files[files$title == "QA_2024_Q1", ], tempdir())
file.size(path)
}