gh_text_file | R Documentation |
Downloads the text file under the specified path from a GitHub repository via GitHub's GraphQL API and returns its content as a string.
gh_text_file(owner, name, path, rev = "HEAD")
owner |
Repository owner's GitHub user or organization name. A character scalar. |
name |
Repository name. A character scalar. |
path |
Path to a file, relative to the repository root. A character scalar. |
rev |
Git revision expression matching the desired Git tree object, e.g. a branch or tag
name or another symbolic reference like |
Works for both public and private repositories, for the latter you just need to set up a sufficiently authorized GitHub Personal Access Token (PAT).
Note that nothing is returned in case of a binary file, as if no file at all existed under the given
path
.
A character scalar, or an empty character vector in case no text file is found under
rev:path
.
Other GitHub functions:
gh_dir_ls()
,
gh_release_latest()
,
gh_releases()
,
gh_text_files()
yay::gh_text_file(owner = "rpkg-dev",
name = "pal",
path = "pal.Rproj",
rev = "HEAD~2") |>
cat()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.