# Offline-friendly example using a local source (no network) — CRAN-safe
if (requireNamespace("withr", quietly = TRUE)) {
withr::local_options(writeAlizer.mock_dir = NULL, writeAlizer.offline = FALSE)
}
src <- tempfile(fileext = ".bin")
writeBin(as.raw(1:10), src)
url <- paste0("file:///", normalizePath(src, winslash = "/"))
# Deterministic and quiet: checksum + cache reuse
sha <- digest::digest(src, algo = "sha256", file = TRUE)
dest <- wa_download("example.bin", url = url, sha256 = sha, quiet = TRUE)
file.exists(dest)
# Using a mock directory to avoid network access:
# options(writeAlizer.mock_dir = "/path/to/local/artifacts")
# dest <- wa_download("rb_mod1a.rda", url = "https://example.com/rb_mod1a.rda")
Run the code above in your browser using DataLab