Need help with storage-on-the-web?
Click the β€œchat” button below for chat support from the developer who created it, or find similar developers for support.
addyosmani

Description

πŸ—ƒ Comparing storage options for the open web in 2016

203 Stars 8 Forks 31 Commits 0 Opened issues

Services available

Need anything else?

What should you use for offline storage of your Progressive Web App?

Recommentations:

  • URL addressable resources: Use the (Service Worker) Cache API
  • All other data: IndexedDB (using a Promise wrapper library)

| Type | Sync | Async | Web Workers | Window | Service Workers | Notes | Libraries | |-------------|------|---------------------|-------------|--------|-----------------|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | IndexedDB | | βœ” (event based) | βœ” | βœ” | βœ” | Nearly unlimited storage. Mandatory complexity (schema versioning, transactions). Security (per-origin). | localForage (promises, legacy browser support), idb-keyval (<500 bytes, promises, if only need key-value), idb (promises, also does iteration, indexing), Dexie (complex queries, secondary indices), PouchDB (sync), Lovefield (relational), ydn-db (dexie-like, works with WebSQL) | | Cache API | | βœ” (promise based) | βœ” | βœ” | βœ” | | sw-toolbox
| Cookies | βœ” | | | | | Size-limited, only strings. | js-cookie, Cookies.js | | Web Storage | βœ” | | | | | Size-limited, only strings. | store.js, lawnchair | | File API |βœ” (callback based) |βœ” |βœ” |βœ” | | Superseded by the File and Directory Entries API | FileAPI library. For file-saving see FileSaver.js and the writable-files proposals | | WebSQL | | βœ” (callback based) | | | | Nearly unlimited storage. Not available in a Web/Service Worker. Rejected by Edge, Firefox. Likely to unship in Chrome. | | | AppCache |βœ” | | | | | Chrome: Deprecating HTTP support, Firefox: Intent to Deprecate | | | | FileSystem | βœ” | βœ” (callback based) | βœ” | βœ” | | Nearly unlimited storage. Sandboxed - not native file access. No interest outside Chrome | | * "Nearly unlimted storage" generally means storage up until the available quota is reached * If the SW cache (Cache API) is full, the browser will fail to cache more data (this applies to all origin storage, including IDB). Date headers can be used to get the age of cached items for cache invalidation.

Current and future work

Resources

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.