store: Store files in a local cache

Description Usage Arguments Value See Also Examples

View source: R/store.R

Description

Resources at a specified URL will be downloaded and copied into the local content-based storage. Local paths will simply be copied into local storage. Identical content is not duplicated.

Usage

1
store(x, dir = content_dir(), algos = default_algos())

Arguments

x

a URL, connection, or file path.

dir

the path we should use for permanent / on-disk storage of the registry. An appropriate default will be selected (also configurable using the environmental variable CONTENTID_HOME), if not specified.

algos

Which algorithms should we compute contentid for? Default "sha256", see details.

Value

the content-based identifier

See Also

retrieve

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Store & retrieve local file
vostok_co2 <- system.file("extdata", "vostok.icecore.co2",
                          package = "contentid")
 id <- store(vostok_co2)
 retrieve(id)
 

 # Store and retrieve content from a URL 
id <- store(paste0("https://knb.ecoinformatics.org/knb/d1/mn/v2/object/",
"ess-dive-457358fdc81d3a5-20180726T203952542"))
retrieve(id)

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