Skip to content

ref_write

man/ref_write.Rd

Also documents
  • ref_read

Usage

ref_write(reference, path, compress = "xz")
ref_read(path, trusted = FALSE)

These wrappers make the on-disk compatibility contract explicit. ref_read() migrates the unversioned development bundle used before Referent 0.1.0 and rejects unknown schemas. Prediction also validates a frozen bundle.

Argument Description
reference A ref_freeze or ref_fit. Plain fits are frozen before
writing.
path Path to an RDS bundle.
compress Passed to saveRDS().
trusted Must be exactly TRUE to acknowledge that path came from an
authenticated, trusted source. The check occurs before deserialization.

RDS is R’s native object format, not a data-only exchange format, and deserializing a malicious RDS file can execute code. ref_read() therefore refuses to deserialize unless trusted = TRUE is supplied explicitly. Only do that for a bundle from an authenticated, trusted source. Schema validation happens after deserialization and does not make an untrusted RDS file safe.

ref_write() invisibly returns path; ref_read() returns a validated ref_freeze.