Ropendal keeps bytes as the transport primitive and makes conversion explicit.
library(Ropendal)
root <- file.path(tempdir(), "ropendal-serializers")
unlink(root, recursive = TRUE)
dir.create(root, recursive = TRUE)
fs <- opendal("fs", root = root)mode = "raw" is the default. mode = "text"
wraps UTF-8 text conversions.
Use serial_config() with mode = "serial"
for explicit object materialization.
note <- structure(list(text = "ok"), class = "ropendal_note")
sc <- serial_config(
"ropendal_note",
sfunc = function(x) charToRaw(x$text),
ufunc = function(x) structure(list(text = rawToChar(x)), class = "ropendal_note")
)
fs_write(fs, "obj.rds", note, mode = "serial", serial_config = sc)
#> [1] TRUE
obj <- fs_read(fs, "obj.rds", mode = "serial", serial_config = sc)
obj$text
#> [1] "ok"