Skip to content

Storage

The Storage namespace provides persistent key-value storage scoped to the current mod. Data persists across game sessions (saved to disk). Each mod has its own isolated namespace — other mods cannot access your data.

For sharing data between mods, use SharedStorage. For session-only data, use Variables.

Storage is global across saves

Storage is not tied to a save file — the same data is visible in every save the player loads. If you want per-playthrough state (e.g. "which of my quests has this save completed"), use SaveStorage instead, otherwise progress from one save will appear in another.

No permission required.

Import

typescript
import { Storage } from "@hotbunny/hackhub-content-sdk";

Methods

Storage.get<T>(key)

Get a value by key. Returns undefined if not found.

Returns: T | undefined

typescript
const score = Storage.get<number>("highScore");
const config = Storage.get<{ difficulty: string }>("config");

Storage.set(key, value)

Set a value by key. The value must be JSON-serializable.

typescript
Storage.set("highScore", 42);
Storage.set("config", { difficulty: "hard", volume: 0.8 });

Storage.remove(key)

Remove a key from storage.

typescript
Storage.remove("highScore");

Storage.clear()

Clear all data in this mod's storage.

typescript
Storage.clear();

Storage.getAll()

Get all stored key-value pairs for this mod.

Returns: Record<string, any>

typescript
const all = Storage.getAll();
console.log(Object.keys(all)); // ["highScore", "config", ...]

Scoping

Storage is automatically scoped to the current mod's ID. If your mod ID is "my-awesome-mod", all keys are stored under that namespace internally. This means:

  • Two mods can use the same key name (e.g. "config") without conflicts
  • You cannot accidentally read or overwrite another mod's data
  • Data is preserved even if the mod is temporarily disabled

HotBunny Interactive Entertainment Inc.