
Write an Object to MinIO (Auto-detect by Extension)
Source:R/minio_write_object.R
minio_write_object.RdSerializes an R object to bytes (raw) based on the file extension of
object and uploads it to MinIO using minio_put_object.
Usage
minio_write_object(
bucket,
object,
x,
...,
content_type = NULL,
multipart = FALSE,
use_https = TRUE,
region = ""
)Arguments
- bucket
Character. Name of the MinIO bucket.
- object
Character. Object key (path) within the bucket. Extension is used to infer the serialization format.
- x
R object to serialize and upload (often a data.frame, list, model, etc.).
- ...
Additional arguments passed to the underlying writer function.
- content_type
Character or
NULL. Optional MIME type. IfNULL, a sensible default is used based on the extension.- multipart
Logical. Whether to use multipart upload. Defaults to
FALSE.- use_https
Logical. Whether to use HTTPS when connecting to MinIO.
- region
Character. Region string required by
aws.s3.
Details
Supported formats are selected by extension:
.csvviautils::write.csv().parquet/.pqviaarrow::write_parquet().jsonviajsonlite::toJSON().xlsxviawritexl::write_xlsx().featherviafeather::write_feather().dtaviahaven::write_dta().rdsviasaveRDS().rda/.RDataviasave()
Additional arguments (...) are forwarded to the underlying writer
selected by extension.
Examples
if (FALSE) { # \dontrun{
# CSV
minio_write_object("assets", "tmp/df.csv", mtcars, row.names = FALSE)
# JSON (returns JSON in MinIO)
minio_write_object("assets", "tmp/config.json", list(a = 1, b = TRUE), auto_unbox = TRUE)
# RDS
minio_write_object("assets", "tmp/model.rds", lm(mpg ~ wt, data = mtcars))
# RData (stores an object named 'x' by default)
minio_write_object("assets", "tmp/objects.RData", mtcars)
} # }