gh_download: Download a file from GitHub

Description Usage Arguments Value Examples

View source: R/github-api.R

Description

This function downloads a file from GitHub in as a binary object.

Usage

1
2
3
4
5
6
7
8
9
gh_download(
  url,
  path,
  headers = NULL,
  accept = NULL,
  token = getOption("github.token"),
  proxy = getOption("github.proxy"),
  ...
)

Arguments

url

(string) The address of the API endpoint.

path

(string) The path to download the file to.

headers

(character, optional) Headers to add to the request. Default: NULL.

accept

(string, optional) The mime format to accept when making the call. Default: NULL.

token

(string or Token, optional) An authorisation token to include with the request. If NULL the OAuth process is triggered. Default: NULL.

proxy

(character, optional) The proxy server to use to connect to the github API. If NULL then no proxy is used. Can be set in the option github.proxy or the environment variable GITHUB_PROXY. Default: NULL.

...

Ignored.

Value

A github string object containing the path, with the attributes:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

  # Find an issue by title
  gh_download(
    url  = "https://api.github.com/repos/ChadGoymer/githapi/zipball/main",
    path = "~/githapi-main.zip"
  )


## End(Not run)

ChadGoymer/githapi documentation built on Oct. 22, 2021, 10:56 a.m.