.hyp Apps
The .hyp
file format is a custom binary format used for Hyperfy v2 Apps that bundles a blueprint configuration with its associated assets.
File Structure
A .hyp
file consists of three main sections:
-
Header Size (4 bytes)
- Uint32 value (little-endian) indicating the size of the header JSON in bytes
-
Header (JSON)
- Contains two main objects:
blueprint
: The app configurationassets
: Metadata for all bundled assets
- Contains two main objects:
-
Asset Data
- Raw binary data of all assets concatenated sequentially
Header Format
The header is a JSON object with the following structure:
{ "blueprint": { "name": "string", "model": "string (optional)", "script": "string (optional)", "props": { [key: string]: { "type": "string", "url": "string" } }, "frozen": "boolean" }, "assets": [ { "type": "model | avatar | script", "url": "string", "size": "number", "mime": "string" } ]}
Blueprint Properties
name
: The name of the app (used for the output filename if not specified)model
: (Optional) URL of the main 3D model filescript
: (Optional) URL of the app’s script fileprops
: Object containing additional properties with associated assetsfrozen
: Boolean flag indicating if the app is locked/frozen
Asset Types
Assets can be of different types:
model
: 3D model files (e.g., .glb)avatar
: VRM avatar filesscript
: JavaScript files
File Operations
Exporting
When creating a .hyp file:
- The blueprint is cloned
- All assets are collected from:
- Main model file
- Script file
- Props with URLs
- Header is created with blueprint and asset metadata
- Header size is written as first 4 bytes
- Header JSON is converted to bytes and written
- All asset files are appended sequentially
Importing
When reading a .hyp file:
- First 4 bytes are read to determine header size
- Header JSON is parsed from the next bytes
- Remaining bytes are split into individual asset files based on size metadata
- Returns an object containing:
- The blueprint configuration
- Array of asset files with their metadata
Usage Example
// Export a .hyp fileconst hypFile = await exportApp(blueprint, resolveFile)
// Import a .hyp fileconst { blueprint, assets } = await importApp(hypFile)
Binary Format Specification
[Header Size (4 bytes)][Header JSON (variable size)][Asset1 Data][Asset2 Data]...
The format uses little-endian encoding for the header size value.