Skip to content

Storage

Checked against 2994ef5 on 2026-11-10 by Capy (review pass: Subagent 124 and fable). The files it covers are unchanged since.

Pages get the web’s storage: localStorage, sessionStorage and IndexedDB. They behave as in a browser, and the data stays on the device.

By default each database is a SQLite file, kept per origin in the app’s data directory:

  • iOS and other Apple platforms: Application Support/niso in the app’s container, with the bundle id as the app’s origin.
  • Android: Context.getFilesDir()/niso, with the package name as origin.
  • Desktop and native apps: $NISO_STORAGE_DIR if set, else the platform’s per-user data directory (~/Library/Application Support/niso/<app>, ~/.local/share/niso/<app>), keyed by the executable’s name.
  • niso-run and tests: a temporary directory, unless --storage DIR.

sessionStorage lives in memory for the life of the document.

Data is keyed by the document’s origin, as on the web. A page loaded from https://example.com/ has that origin; a page an Apple app serves from its bundle is at https://<bundle id>.app.niso/; a native app’s document has the app’s origin (niso_dom_set_app_origin). A document with an opaque origin, such as a data: URL, has no storage: the APIs throw SecurityError.

Storage goes through a driver interface at the level of databases, object stores and ordered records. niso ships SQLite (the default), memory (nothing persists) and a C adapter, so a host can keep its data in its own database or an encrypted file (niso_dom_set_storage_driver, Storage driver). The full design, with transactions and file layout, is in Storage drivers.

There are no cookies (document.cookie and HTTP cookies), no Cache API and no OPFS.