WebExeBuilder Documentation

Storage

Persistent per-app file and key-value storage

Namespace: web.storage

Overview

The web.storage API provides dedicated persistent storage for each app, isolated in its own folder under %LOCALAPPDATA%\ezWareLab\WebExeBuilder\{AppGUID}\storage\. This folder is created automatically at app startup — no setup needed.

Two storage models are available:

  • Key-value store — simple named values backed by storage.json. Ideal for settings, scores, preferences, and small data.
  • File store — read/write named files directly in the storage folder. Ideal for game saves, JSON documents, exported data, or any structured content.

Available Methods

Key-Value Store

  • set - web.storage.set
  • get - web.storage.get
  • remove - web.storage.remove
  • clear - web.storage.clear
  • keys - web.storage.keys

File Store

Quick Example

// Key-value: save and restore a high score
await web.storage.set({ key: 'highScore', value: '9500' });
const score = await web.storage.get({ key: 'highScore' });
console.log('High score:', score);  // "9500"

// File: save a full game state as JSON
const saveData = JSON.stringify({ level: 3, health: 80, inventory: ['sword', 'shield'] });
await web.storage.writeFile({ name: 'save1.json', content: saveData });

// File: restore it
const raw = await web.storage.readFile({ name: 'save1.json' });
const state = JSON.parse(raw);

Notes

  • The storage folder is created automatically — you never need to create it manually
  • File names are sanitized to prevent directory traversal — path separators and .. are stripped
  • storage.json is reserved for the key-value store — do not use it as a file name
  • Storage persists across app sessions and updates as long as the app GUID stays the same
  • Use getDir() to get the full folder path when combining with other APIs (e.g. web.variables.saveVariables)