resolve: Resolve content from a content identifier

View source: R/resolve.R

resolveR Documentation

Resolve content from a content identifier

Description

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).

Usage

resolve(
  id,
  registries = default_registries(),
  verify = TRUE,
  store = FALSE,
  dir = content_dir(),
  ...
)

Arguments

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 registries argument.

...

additional arguments

Details

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.

See Also

query query_local query_remote

Examples



# ensure some content in local storage for testing purposes:
vostok_co2 <- system.file("extdata", "vostok.icecore.co2",
                          package = "contentid")
store(vostok_co2)


resolve(paste0(
 "hash://sha256/9412325831dab22aeebdd6",
 "74b6eb53ba6b7bdd04bb99a4dbb21ddff646287e37")
)





cboettig/contentid documentation built on Oct. 24, 2023, 1:03 p.m.