Skip to main content

Moving from localForage

localForage and Strata Storage both give you async key-value calls over IndexedDB. If your app only ever runs in a browser and you're happy with localForage, there's no reason to move. Move when the same code also ships under Capacitor, or you want sessionStorage, cookies or the URL behind the same call.

The calls​

localForageStrata Storage
localforage.setItem(key, value)storage.set(key, value)
localforage.getItem(key)storage.get(key)
localforage.removeItem(key)storage.remove(key)
localforage.keys()storage.keys()
localforage.clear()storage.clear()
localforage.config({ driver })defineStorage({ defaultStorages })

There's no iterate(): call keys() and get() in a loop, or use query() when you're filtering on a field of the value.

Carry existing values over​

The two libraries don't share a database. Strata's IndexedDB adapter opens its own (StrataStorage unless you configure dbName), so existing values have to be copied once. Run this at startup before anything reads the moved keys.

import localforage from 'localforage';
import { defineStorage } from 'strata-storage';

export const storage = defineStorage({ defaultStorages: ['indexedDB', 'localStorage', 'memory'] });

export async function moveFromLocalForage(): Promise<void> {
if (await storage.get<boolean>('moved:localforage')) return;
for (const key of await localforage.keys()) {
await storage.set(key, await localforage.getItem(key));
}
await storage.set('moved:localforage', true);
}

The flag goes last, so a tab closed halfway repeats the copy on the next start instead of skipping what's left.

Before you clear the old store​

Read a few real keys back through storage.get(). If you keep Blob values, read one of those too: IndexedDB can hold it, but a localStorage fallback can't. Once you're satisfied, ship await localforage.clear() in a later release, so a rollback still finds its data.

Adding native stores is a separate step: see Capacitor setup and check the read on a device.

localForage as we checked it​

Last checked 7 Nov 2026. "Not stated" means the pages we checked don't mention it, not that the library can't do it. Check localForage yourself, or see the side-by-side page.

Store or capabilitylocalForageStrata Storage
localStorageYes (source, 7 Nov 2026)Yes
IndexedDBYes (source, 7 Nov 2026)Yes
sessionStorageNot stated on the pages we checkedYes
CookiesNot stated on the pages we checkedYes
URL parameters as a storeNot stated on the pages we checkedYes
iOS KeychainNot stated on the pages we checkedYes
Android secure storage (Keystore-backed)Not stated on the pages we checkedYes
Native preferences (UserDefaults / SharedPreferences)Not stated on the pages we checkedYes
Web and native stores behind one APINo. The README says it is designed to run in the browser; no native store is described (source, 7 Nov 2026)Yes
No runtime dependenciesNo. Depends on lie (source, 7 Nov 2026)Yes
Package factlocalForageStrata Storage
LicenceApache-2.0 (source)MIT (source)
npm version1.10.03.1.4
Bundle size8,680 bytes gzipped, 28,346 minified, version 1.10.0, 7 Nov 2026 (source)21,468 bytes gzipped, 79,645 minified, version 3.1.4, 7 Nov 2026 (source)
Weekly downloads11,046,386, 31 Oct 2026 to 6 Nov 2026 (source)486, 31 Oct 2026 to 6 Nov 2026 (source)