Rask
Rask
v0.23.1-alpha.0.496
You're reading the Rask v0.23.1-alpha.0.496 guides. Updated .View source
All guides

IIndexedDb

Large async key/value store.

  • Wraps: IndexedDB
  • MDN: IndexedDB API
  • Home: Rask.Core.Browser (all hosts)
  • Shape: one-shot
  • Availability: Web/Server ✅ · PWA/WASM ✅

Text and bytes

OpenStore(name) returns an IKeyValueStore with two pairs of accessors:

var store = await indexedDb.OpenStore("cache");

await store.Set("profile", json);              // string
var json2 = await store.Get("profile");

await store.SetBytes("thumbnail", pngBytes);   // byte[]
var png = await store.GetBytes("thumbnail");

Use the byte overloads for anything that is not text — an image, a compressed blob, a database file. They store a real Uint8Array, so a megabyte of bytes costs a megabyte of quota; base64 appears only in transit, because that is what marshals identically across the JS interop boundary on every host.

The two pairs are not interchangeable: read a key with the same kind of accessor you wrote it with.

See also

Confirm