
Download a file with an automatic Wayback fallback (via rmoriebricklayer)
Source:R/bricklayer.R
morie_download.RdThin bridge to rmoriebricklayer::friendly_download(): downloads
url to target_path, falling back to the archived Wayback
snapshot if the live source is unreachable – useful for pinned open-data
sources (e.g. the OTIS "Data on Inmates in Ontario" releases) that may move
or change upstream.
Usage
morie_download(
url,
target_path,
attempt_wayback = NULL,
label = basename(target_path),
size = NULL
)Arguments
- url
Live source URL.
- target_path
Destination file path.
- attempt_wayback
Logical or
NULL; whether to fall back to the Wayback snapshot when the live fetch fails (passed through to bricklayer;NULLuses the bricklayer default).- label, size
Shown by the progress bar: a short name for the file and its expected size in bytes when known (a percent bar instead of a spinner).
Value
The downloaded path, per rmoriebricklayer::friendly_download().
Examples
# \donttest: needs an internet connection, so it is not run by
# default; it runs fine for a user who has one.
# \donttest{
morie_download(
"https://data.ontario.ca/dataset/data-on-inmates-in-ontario",
tempfile(fileext = ".html")
)
# }