serialize: Serialize

View source: R/sakura.R

serializeR Documentation

Serialize

Description

An extension of R native serialization using the 'refhook' system for custom serialization and unserialization of non-system reference objects.

Usage

serialize(x, hook = NULL)

unserialize(x, hook = NULL)

Arguments

x

an object.

hook

[default NULL] optionally, a configuration returned by serial_config.

Value

For serialize: a raw vector. For unserialize: the unserialized object.

Examples

vec <- serialize(data.frame())
vec
unserialize(vec)


obj <- list(arrow::as_arrow_table(iris), arrow::as_arrow_table(mtcars))
cfg <- serial_config(
  "ArrowTabular",
  arrow::write_to_raw,
  function(x) arrow::read_ipc_stream(x, as_data_frame = FALSE)
)
raw <- serialize(obj, cfg)
unserialize(raw, cfg)


sakura documentation built on April 3, 2025, 7:46 p.m.