On this page
Overview
localForage is a JavaScript storage library that exposes IndexedDB and WebSQL through an API similar to localStorage. It provides asynchronous Promise/callback methods and falls back to localStorage when the richer drivers are unavailable.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Run setItem and getItem asynchronously with Promises or callbacks
setItem(), getItem(), removeItem(), and related methods resemble localStorage while remaining asynchronous. Both Promises and Node-style callbacks are supported, and the README recommends Promises when there is no specific preference.
Sources: [1]
Store objects, Blobs, and TypedArrays in addition to strings
The API accepts JSON-serializable JavaScript objects plus ArrayBuffers, Blobs, and TypedArrays. When localStorage is the backend, localForage performs the required serialization and parsing.
Sources: [1]
Configure drivers and stores and separate multiple instances
config() controls driver, database name, store name, and related settings, while createInstance() creates independent stores within the same application.
Sources: [1]
Best fit
Fits offline data and client-side caches that need a small persistence API
It is useful when a web application wants Promise-based key-value persistence without spreading raw IndexedDB calls throughout UI code.
Sources: [1]
Before adoption
The runtime target is a browser environment
The README describes localForage as a browser library, and its project tests explicitly require a browser environment. Node.js or SSR-only code should not assume the same storage drivers are available.
Sources: [1]
Capacity and behavior vary with the selected fallback backend
When IndexedDB or WebSQL is unavailable, localForage falls back to localStorage. The README warns that localStorage limits make storing many large Blobs impractical, so storage volume and target-browser behavior need validation.
Sources: [1]
Official sources
- [1]localForage 1.10.0 README(2026-10-05)
- [2]localForage 1.10.0 package metadata(2026-10-05)
- [3]localForage 1.10.0 changelog(2026-10-05)
- [4]localForage 1.10.0 release(2026-10-05)
- [5]localForage Apache-2.0 license(2026-10-05)
Supplemental curator note
localForage is easy to evaluate when a web application wants IndexedDB-backed persistence without adopting the raw IndexedDB API everywhere. Storage limits and behavior vary by driver, and the project documentation explicitly treats a real browser environment as the runtime target.
Try it in 3 steps
- 1
Install localForage 1.10.0 in an isolated project
Pin the current package version in a temporary project for browser-storage verification.
demo=$(mktemp -d "${TMPDIR:-/tmp}/localforage.XXXXXX") && cd "$demo" && npm init -y >/dev/null && npm install --save-exact localforage@1.10.0 - 2
Create minimal HTML that stores, reads, and removes an object
Use the Promise API to persist a JavaScript object, render the retrieved value, and then remove the demo data.
printf "%s\n" '<!doctype html>' '<meta charset="utf-8">' '<script src="./node_modules/localforage/dist/localforage.js"></script>' '<script>' "(async () => {" " await localforage.setItem('oss-tanbou-demo', { ready: true });" " const value = await localforage.getItem('oss-tanbou-demo');" " document.body.textContent = JSON.stringify(value);" " await localforage.removeItem('oss-tanbou-demo');" "})();" '</script>' > index.html - 3
Open the HTML in a browser and verify async persistence
Open
index.htmlin a browser and confirm the page shows{"ready":true}while localForage selects an available browser storage driver.index.html
Growth
Growth trends · Last 30 days
25,809 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 0
- Open PRs
- 35
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- localforage
- localstorage
- javascript
- offline
- storage
- indexeddb
- websql
- Stars
- 25,809
- Forks
- 1,288
- Watchers
- 302
- Open issues
- 215
- Contributors
- 94
- Owner type
- Organization
- Primary language
- JavaScript
- License
- Apache-2.0
- Repository last updated
- Jul 30, 2024
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Highlight.js25,005 Stars
3 shared tag(s) · Same language
highlight source code with more than 180 language definitions and optionally auto-detect the language
JavaScript - js-cookie22,573 Stars
3 shared tag(s) · Same language
manage browser cookie creation, reads, removal, and attributes through a small JavaScript API
JavaScript - Autoprefixer22,211 Stars
3 shared tag(s) · Same language
generate only the vendor prefixes required by Browserslist and Can I Use data
JavaScript - SweetAlert218,098 Stars
3 shared tag(s) · Same language
replace alert, confirm, and prompt dialogs with WAI-ARIA-aware popups that resolve through Promises
JavaScript - Less17,025 Stars
3 shared tag(s) · Same language
compile stylesheets with variables, mixins, and nesting into standard CSS with lessc
JavaScript - Tippy.js12,240 Stars
3 shared tag(s) · Same language
position tooltips, popovers, and dropdowns with Popper and attach them to hover, focus, or click interactions
JavaScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.