IStorage interface.
NodeStorage
For Node.js environments, providing access to the local file system.Constructor
Properties
Static Methods
Example Usage
BrowserStorage
For browser environments, providing persistent client-side storage using IndexedDB via localforage.Constructor
Properties
Static Methods
Configuration
BrowserStorage automatically configures localforage with:Example Usage
HttpStorage
For read-only access to files served over HTTP/HTTPS.Constructor
Properties
Behavior
- Automatically appends trailing slash to
baseUrl - Read-only (save operations will fail)
- Files are fetched on-demand via HTTP GET
- Good for serving sample packs or templates
Example Usage
GitHubStorage
For read-only access to GitHub repositories.Constructor
Properties
Security Restrictions
For security reasons, GitHubStorage only allows access to repositories owned by:microsoftmojang
Example Usage
ZipStorage
For working with ZIP archives, including .mcpack, .mcaddon, .mcworld, and .mctemplate files.Constructor
Properties
Loading Methods
Generating Methods
Static Factory Methods
Security Validation
ZipStorage includes security checks:Example Usage
Storage (In-Memory)
For temporary in-memory storage without persistence.Constructor
Properties
Behavior
- Files and folders exist only in memory
- No persistence between sessions
- Fast for temporary operations
- Good for testing and transformations
Example Usage
StorageBase
All storage implementations extendStorageBase, which provides common functionality:
Common Features
Version Management
Scan for Changes
Choosing a Storage Implementation
| Use Case | Implementation | Reason |
|---|---|---|
| Desktop app file access | NodeStorage | Direct file system access |
| Web app data persistence | BrowserStorage | Client-side storage with IndexedDB |
| Serving sample packs | HttpStorage | Simple HTTP hosting |
| Microsoft/Mojang samples | GitHubStorage | Access official repositories |
| Working with .mcpack files | ZipStorage | Read/write compressed archives |
| Temporary transformations | Storage | No persistence overhead |
| Unit testing | Storage | Fast, no I/O |