Skip to contents

Produces a ZIP archive SeaTable can import. Round-tripping is lossless: reading a file and writing it back yields a content.json that parses to an identical structure, verified against a real 750 KB export.

Usage

hb_write_dtable(x, path, ..., assets = TRUE, overwrite = TRUE)

Arguments

x

A harbour_dtable.

path

Destination path.

...

These dots are for future extensions and must be empty.

assets

Whether to repack the extracted asset tree, if there is one. Default TRUE.

overwrite

Refuse to clobber an existing file unless TRUE.

Value

x, invisibly.

Examples

path <- system.file("extdata", "example.dtable", package = "harbouR")
base <- hb_read_dtable(path)

out <- tempfile(fileext = ".dtable")
hb_write_dtable(base, out)
#> Warning: This base references 7 bundled assets that will not be written.
#> ✖ The attachment cells will point at files the archive does not contain.
#> ℹ Re-read it with `hb_read_dtable(path, assets = "extract")`.

# the round trip preserves the base exactly
identical(hb_read_dtable(out)$content, base$content)
#> [1] TRUE