pin: Access the latest content at a URL

Description Usage Arguments Details See Also Examples

View source: R/pin.R

Description

This will download the requested object to a local cache and return the local path of the object. first time it is run, and then use a local cache unless content has changed. This behavior is similar to pins::pin(), but uses cryptographic content hashes. Because content hashes are computed in a fast public content registry, this will usually be faster than downloading on a local connection, but slower than checking eTags in headers. Use resolve

Usage

1
2
3
4
5
6
pin(
  url,
  verify = TRUE,
  dir = content_dir(),
  registries = "https://hash-archive.org"
)

Arguments

url

a URL to a web resource

verify

logical, default TRUE. Should we verify the content identifier (SHA-256 hash) of content at the URL before we look for a local cache?

dir

path to the local store directory. Defaults to first local registry given to the registries argument.

registries

list of registries at which to register the URL

Details

at this time, verify mode cannot process FTP resources. Use verify = FALSE to enable a fast read from cache. This essentially allows a URL to act as an identifier, and is a good choice for URLs known to be version stable. If verify = FALSE, this will merely attempt to find a local copy of data previously associated (registered) at that URL. It will not attempt to compute the content identifier of the content at the URL, thus the local copy may or may not match the content at that address.

See Also

resolve

Examples

1
2
3
4
5
6
7
url <- paste0("https://data.giss.nasa.gov/gistemp/graphs/graph_data/",
       "Global_Mean_Estimates_based_on_Land_and_Ocean_Data/graph.txt")
       
x <- pin(url)

## Faster if we're okay assuming URL is content-stable
x <- pin(url, verify = FALSE)

cboettig/contentid documentation built on April 1, 2021, 11:25 p.m.