Skip to contents

Downloads an object (optionally a specific version) from S3 to a temporary file and deserializes it using the provided read function. Complements paws_write_object().

Usage

paws_read_object(
  bucket,
  path,
  version_id = NULL,
  read_fun = readr::read_rds,
  verbose = FALSE
)

Arguments

bucket

Character scalar. Name of the S3 bucket.

path

Character scalar. Full S3 key (path inside the bucket).

version_id

Optional character scalar. Specific version ID to read. If NULL, the latest version is read.

read_fun

Function used to deserialize the object after download. Defaults to base::readRDS().

verbose

Logical. If TRUE, prints informational messages.

Value

The deserialized R object.

Examples

if (FALSE) { # \dontrun{
# Read latest version
obj <- paws_read_object(
  bucket = "g6tr-dl-test",
  path = "project/data/srv_main/.rds"
)

# Read specific version
obj <- paws_read_object(
  bucket = "g6tr-dl-test",
  path = "g6tr.dl/data/srv_main/.rds",
  version_id = "Hr.IOP00nTbbb1KRko.VcxRGa90UGMjG"
)
} # }