scratch-storage
Version:
Load and store project and asset files for Scratch 3.0
47 lines (44 loc) • 1.52 kB
JavaScript
const DataFormat = require('./DataFormat');
/**
* Enumeration of the supported asset types.
* @type {Object.<String,AssetType>}
* @typedef {Object} AssetType - Information about a supported asset type.
* @property {string} contentType - the MIME type associated with this kind of data. Useful for data URIs, etc.
* @property {string} name - The human-readable name of this asset type.
* @property {DataFormat} runtimeFormat - The default format used for runtime, in-memory storage of this asset. For
* example, a project stored in SB2 format on disk will be returned as JSON when loaded into memory.
* @property {boolean} immutable - Indicates if the asset id is determined by the asset content.
*/
const AssetType = {
ImageBitmap: {
contentType: 'image/png',
name: 'ImageBitmap',
runtimeFormat: DataFormat.PNG,
immutable: true
},
ImageVector: {
contentType: 'image/svg+xml',
name: 'ImageVector',
runtimeFormat: DataFormat.SVG,
immutable: true
},
Project: {
contentType: 'application/json',
name: 'Project',
runtimeFormat: DataFormat.JSON,
immutable: false
},
Sound: {
contentType: 'audio/x-wav',
name: 'Sound',
runtimeFormat: DataFormat.WAV,
immutable: true
},
Sprite: {
contentType: 'application/json',
name: 'Sprite',
runtimeFormat: DataFormat.JSON,
immutable: true
}
};
module.exports = AssetType;