repo_pull: Download item remote content

Description Usage Arguments Details Value Examples

View source: R/repo_public.R

Description

Download item remote content

Usage

1

Arguments

name

Name of the existing item that will be updated.

replace

If TRUE, existing item's object is overwritten.

Details

Repo index files can be used as pointers to remote data. The pull function will download the actual data from the Internet, including regular items or attachment. Another use of the URL item's parameter is to attach a remote resource without downloading it.

Value

Used for side effects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Repository creation
rp_path <- file.path(tempdir(), "example_repo")
rp <- repo_open(rp_path, TRUE)
remote_URL <- paste0("https://github.com/franapoli/repo/blob/",
                     "untested/inst/remote_sample.RDS?raw=true")

## The following item will have remote source
rp$put("Local content", "item1", "Sample item 1", "tag",
         URL = remote_URL)
print(rp$get("item1"))

## suppressWarnings(try(rp$pull("item1"), TRUE))
 tryCatch(rp$pull("item1"),
         error = function(e)
             message("There were warnings whle accessing remote content"),
         warning = function(w)
             message("Could not download remote content")
         )
print(rp$get("item1"))

## wiping temporary repo
unlink(rp_path, TRUE)

repo documentation built on March 26, 2020, 8:25 p.m.