Skip to content

Serializes an Automerge document to the standard binary format, which can be saved to disk or transmitted over a network. The binary format is compatible across all Automerge implementations (JavaScript, Rust, etc.).

Usage

am_save(doc)

Arguments

doc

An Automerge document

Value

A raw vector containing the serialized document

Examples

doc <- am_create()
bytes <- am_save(doc)
bytes
#>  [1] 85 6f 4a 83 b8 1a 95 44 00 04 00 00 00 00

# Save to file
file <- tempfile()
writeBin(am_save(doc), file)

unlink(file)
am_close(doc)