localForage is a fast and simple offline storage library that provides an asynchronous, localStorage-like API using IndexedDB, WebSQL, or localStorage as fallback. Current stable version is 1.10.0, with maintenance-level updates. It simplifies client-side storage by automatically selecting the best available backend and supporting promises, callbacks, and async/await. Key differentiator: works with all modern browsers, handles Blobs and TypedArrays, and has a tiny footprint (~1.2KB gzipped).
npm install localforageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Quickstart example using async/await to get or set a value in localForage.
Use `localforage.ready()` to detect the actual driver or use `localforage.supports(driverName)` before calling setDriver.
Use IndexedDB as preferred backend; avoid relying on WebSQL.
Ensure that the driver supports the data type; use `localforage.driver()` to check which driver is active.
Always pass a callback or use .catch() to handle errors; mixing callbacks and promises can lead to unexpected behavior.
Use `import localforage from 'localforage'` or `const localforage = require('localforage')`; ensure script tag is placed after the library.Add a script tag pointing to localforage's dist file, e.g., `<script src="node_modules/localforage/dist/localforage.js"></script>`.
Use `localforage.ready()` to wait for initialization, or use promises to chain operations.