Save and serialize designs in CE.SDK for later retrieval, sharing, or storage using string or archive formats.
CE.SDK provides two formats for persisting designs. Choose the format based on your storage and portability requirements.
Save Format Comparison#
| Format | Method | Assets | Best For |
|---|---|---|---|
| String | saveToString() | Referenced by URL | Database storage, cloud sync |
| Archive | saveToArchive() | Embedded in ZIP | Offline use, file sharing |
String format produces a lightweight Base64-encoded string where assets remain as URL references. Use this when asset URLs will remain accessible.
Archive format creates a self-contained ZIP with all assets embedded. Use this for portable designs that work offline.
Save to String#
Serialize the current scene to a Base64-encoded string suitable for database storage.
const sceneString = await engine.scene.saveToString();The string contains the complete scene structure but references assets by their original URLs.
Save to Archive#
Create a self-contained ZIP file with the scene and all embedded assets.
const archiveBlob = await engine.scene.saveToArchive();The archive includes all pages, elements, and asset data in a single portable file.
Write to File System#
Use Node.js writeFileSync to persist saved designs to the file system.
Scene strings can be written directly as text:
writeFileSync(`${outputDir}/scene.scene`, sceneString);For archives, convert the Blob to a Buffer before writing:
const archiveBuffer = Buffer.from(await archiveBlob.arrayBuffer());writeFileSync(`${outputDir}/scene.zip`, archiveBuffer);Load Scene from File#
Read a previously saved .scene file from disk and restore it to the engine.
const sceneString = readFileSync(`${outputDir}/scene.scene`, 'utf-8');await engine.scene.loadFromString(sceneString);Scene files are lightweight but require the original asset URLs to remain accessible.
Load Archive from File#
Read a self-contained .zip archive from disk with all embedded assets.
const archiveBuffer = readFileSync(`${outputDir}/scene.zip`);const archiveBlob = new Blob([archiveBuffer]);await engine.scene.loadFromArchive(archiveBlob);Archives are portable and work offline since all assets are bundled within the file.
API Reference#
| Method | Description |
|---|---|
engine.scene.saveToString() | Serialize scene to Base64 string |
engine.scene.saveToArchive() | Save scene with assets as ZIP blob |
engine.scene.loadFromString() | Load scene from serialized string |
engine.scene.loadFromArchive() | Load scene from archive blob |
engine.scene.loadFromURL() | Load scene from remote URL |
engine.scene.loadFromArchiveURL() | Load scene from remote ZIP archive |
Next Steps#
- Export Overview - Export designs to image, PDF, and video formats
- Load Scene - Load scenes from remote URLs and archives
- Store Custom Metadata - Attach metadata like tags or version info to designs
- Partial Export - Export individual blocks or selections