download_file: Download a file from GitHub

Description Usage Arguments Details Value Examples

Description

This function downloads a file in the specified commit to the path provided.

Usage

1
download_file(from_path, to_path, ref, repo, ...)

Arguments

from_path

(string) The path to the file to download, within the repository.

to_path

(string) The path to download the file to.

ref

(string) Either a SHA, branch or tag used to identify the commit.

repo

(string) The repository specified in the format: owner/repo.

...

Parameters passed to gh_request().

Details

Note: The GitHub API imposes a file size limit of 100MB for this request.

For more details see the GitHub API documentation:

Value

download_file() returns the path where the file is downloaded to.

Examples

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

  # Download the README file from the main branch
  download_file(
    from_path = "README.md",
    to_path   = "~/README.md",
    ref       = "main",
    repo      = "ChadGoymer/githapi"
  )


## End(Not run)

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