Requested content can be found at mutiple locations: cached to disk, or available at one or more URLs. This function provides a mechanism to always return a single, local path to the content requested, (provided the content identifier can be found in at least one of the registries).
resolve( id, registries = default_registries(), verify = TRUE, store = FALSE, dir = content_dir(), ... )
id | A content identifier, see content_id |
---|---|
registries | list of registries at which to register the URL |
verify | logical, default TRUE. Should we verify that content matches the requested hash? |
store | logical, should we add remotely downloaded copy to the local store? |
dir | path to the local store directory. Defaults to first local registry given to
the |
... | additional arguments |
Local storage is checked first as it will allow us to bypass downloading content when a local copy is available. If no local copy is found but one or more remote URLs are registered for the hash, downloads from these will be attempted in order from most recent first.
query query_local query_remote
if (FALSE) { # interactive() ## Real users won't use a temporary dir Sys.setenv("CONTENTID_REGISTRIES" = tempdir()) # ensure some content in local storage for testing purposes: vostok_co2 <- system.file("extdata", "vostok.icecore.co2", package = "contentid") store(vostok_co2) # \donttest{ resolve(paste0( "hash://sha256/9412325831dab22aeebdd6", "74b6eb53ba6b7bdd04bb99a4dbb21ddff646287e37") ) # } ## Real users won't use a temporary dir Sys.unsetenv("CONTENTID_REGISTRIES") }