# Create, save, and reload
doc1 <- am_create()
bytes <- am_save(doc1)
doc2 <- am_load(bytes)
doc2
# Save to and load from file
doc3 <- am_create()
file <- tempfile()
writeBin(am_save(doc3), file)
doc4 <- am_load(readBin(file, "raw", 1e5))
unlink(file)
am_close(doc1)
am_close(doc2)
am_close(doc3)
am_close(doc4)
Run the code above in your browser using DataLab