Skip to main content

Overview

Workspace file preview lets you display binary files stored in a workspace database directly inside the panel. Files are passed as base64-encoded strings and the panel converts them to blob URLs internally — no server required. Supported categories: image, audio, video, PDF, font, and a hex dump fallback for generic binary files.

Supported File Types

Creating a Binary File Artifact

Use BINARY_EXT_LANGUAGE to map the file extension to the correct language group, then call createArtifact with the base64 content:
The panel detects the language value, creates a blob URL from the base64 content, and renders the appropriate element automatically.

Browser Support Notes

Blob URL Lifecycle

The panel manages blob URL creation and cleanup automatically:
  • A blob URL is created the first time an artifact is displayed.
  • It is cached for the lifetime of the artifact tab.
  • When a tab is closed or the panel unmounts, URL.revokeObjectURL() is called automatically.
No manual cleanup is needed on the caller side.

Extending with Custom Types

BINARY_EXTS, BINARY_EXT_LANGUAGE, and the utilities from binaryPreview.js are exported as public API so you can support additional file types: