Search
Loading...
Skip to content

Save

Save and serialize designs in CE.SDK for later retrieval, sharing, or storage using string or archive formats.

Save designs showing different save format options

8 mins
estimated time
Download
StackBlitz
GitHub

CE.SDK provides two formats for persisting designs. Choose the format based on your storage and portability requirements.

Save Format Comparison#

FormatMethodAssetsBest For
StringsaveToString()Referenced by URLDatabase storage, cloud sync
ArchivesaveToArchive()Embedded in ZIPOffline 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.

Download to User Device#

Use cesdk.utils.downloadFile() to trigger a browser download with the correct MIME type.

For scene strings, convert to a Blob first:

const sceneBlob = new Blob([sceneString], {
type: 'application/octet-stream'
});
await cesdk.utils.downloadFile(sceneBlob, 'application/octet-stream');

For archive blobs, pass directly to the download utility:

await cesdk.utils.downloadFile(archiveBlob, 'application/zip');

This utility handles creating and revoking object URLs automatically.

Load Scene from File#

Use the built-in importScene action to open a file picker for .scene files. This restores a previously saved design from its serialized string format.

const handleLoadScene = async () => {
await cesdk.actions.run('importScene', { format: 'scene' });
};

Scene files are lightweight but require the original asset URLs to remain accessible.

Load Archive from File#

Load a self-contained .zip archive that includes all embedded assets.

const handleLoadArchive = async () => {
await cesdk.actions.run('importScene', { format: 'archive' });

Archives are portable and work offline since all assets are bundled within the file.

Built-in Save Action#

CE.SDK includes a built-in saveScene action that integrates with the navigation bar.

Running an Action#

Trigger the default save behavior programmatically using actions.run():

await cesdk.actions.run('saveScene');

This executes the registered handler for saveScene, which by default downloads the scene file.

Customizing an Action#

Override the default behavior by registering a custom handler:

cesdk.actions.register('saveScene', async () => {
const sceneString = await engine.scene.saveToString();
// Send to your backend API
console.log('Custom save:', sceneString.length, 'bytes');
});

The registered handler runs when the built-in save button is clicked or when the action is triggered via actions.run().

API Reference#

MethodDescription
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
cesdk.utils.downloadFile()Download blob or string to user device
cesdk.actions.run()Execute a registered action with parameters
cesdk.actions.register()Register or override an action handler

Next Steps#