gh_file: Gets a file from a github repo, using the Data API blob...

Description Usage Arguments Value

View source: R/utils.R

Description

This avoids the 1MB limit of the content API and uses [gh::gh] to deal with authorization and such. See https://developer.github.com/v3/git/blobs/ and https://gist.github.com/noamross/73944d85cad545ae89efaa4d90b049db

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
gh_file(
  url = NULL,
  ref = NULL,
  owner = NULL,
  repo = NULL,
  path = NULL,
  to_disk = TRUE,
  destfile = NULL,
  .token = NULL,
  .api_url = NULL,
  .method = "GET",
  .limit = NULL,
  .send_headers = NULL
)

Arguments

url

the URL of the file to download via API, of the form ':owner/:repo/blob/:path

ref

the reference of a commit: a branch name, tag, or commit SHA

owner, repo, path

alternate way to specify the file. These will override values in 'url'

to_disk, destfile

write file to disk (default=TRUE)? If so, use the name in 'destfile', or the original filename by default

.token, .api_url, .method, .limit, .send_headers

arguments passed on to [gh::gh]

Value

Either the local path of the downloaded file (default), or a raw vector


cont-limno/LAGOSNEgis documentation built on Aug. 10, 2021, 10:53 a.m.