Giter Club home page Giter Club logo

storage-on-the-web's Introduction

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

storage-on-the-web's People

Contributors

addyosmani avatar newswim avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.