pb_write: Write one object to repo/release

View source: R/pb_write.R

pb_writeR Documentation

Write one object to repo/release

Description

A convenience wrapper around writing an object to a temporary file and then uploading to a specified repo/release.

Usage

pb_write(
  x,
  file,
  ...,
  repo = guess_repo(),
  tag = "latest",
  write_function = guess_write_function(file),
  .token = gh::gh_token()
)

Arguments

x

object: memory object to save to piggyback

file

string: file name

...

additional arguments passed to write_function

repo

string: GH repository name in format "owner/repo". Default guess_repo() tries to guess based on current working directory's git repo

tag

string: tag for the GH release, defaults to "latest"

write_function

function: used to write an R object to file, where the object is passed as the first argument, the filename as the second argument, and any additional arguments are subsequently passed in via .... Default guess_write_function(file) will check the file extension and try to find an appropriate write function if the extension is one of rds, csv, tsv, parquet, txt, or json, and will abort if not found.

.token

GitHub authentication token, see gh::gh_token()

Value

Writes file to release and returns github API response

See Also

Other pb_rw: guess_read_function(), guess_write_function(), pb_read()

Examples



  pb_write(mtcars, "mtcars.rds", repo = "tanho63/piggyback-tests")
  #> ℹ Uploading to latest release: "v0.0.2".
  #> ℹ Uploading mtcars.rds ...
  #> |===============================================================| 100%



cboettig/piggyback documentation built on Feb. 29, 2024, 2:35 a.m.