Export
Stream a workspace
Section titled “Stream a workspace”for await (const record of db.$export()) { if (record.type === "row") save(record.model, record.data); // typed per model}npx tapedb export --workspace <uuid> [--url <worker-url>] --out workspace.ndjson # TAPEDB_TOKEN, or a dev claimThe engine streams NDJSON: a header line with the models exported and any the caller may not read, one row line per row (model by model, in id order, through the same read rules as any query), one file line per file in the index (bytes stay in R2), and an end line with counts. Rows are read 1,000 at a time as the stream is consumed, so a large workspace never sits in memory.
Writes keep landing during an export. end.consistent is true when none did, and the export is then the workspace exactly at end.seq. An export that stops early ends with an error line instead of end; the CLI exits 1.