3

What is the maximum size of content body that you can store in CacheStorage for mobile browsers?

Specifically, cache.add(...) below.

https://developer.mozilla.org/en-US/docs/Web/API/Cache

None of the other answers linked are recent or refer to CacheStorage or the Cache API. Question is not a duplicate.

cfbd
  • 980
  • 2
  • 9
  • 21
  • Han.. I was right in closing it with https://stackoverflow.com/questions/38218859/whats-the-size-limit-of-cache-storage-for-service-worker [From MDN](https://developer.mozilla.org/en-US/docs/Web/API/Cache): '*Cache quota usage estimates are available via the StorageEstimate API.*" – Kaiido May 03 '19 at 05:24
  • @Kaiido no these are different questions. Maximum size of content body is not the same as total overall quota. – cfbd May 05 '19 at 21:47
  • yes it is. [Point 9](https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm) If the cache write operation in the previous two steps failed due to exceeding the granted quota limit, throw a "QuotaExceededError" DOMException. – Kaiido May 05 '19 at 21:57
  • Exceeding the quota limit overall is one thing, but is there a limit per file? Put another way, hypothetically could you cache a 1GB file if there was enough disk space in Chrome? – cfbd May 06 '19 at 01:51
  • yes you could, the other limit I guess could be RAM, but I'm not even sure, should probably be streamed to disk directly. – Kaiido May 06 '19 at 02:09

1 Answers1

0

From here:

How much can you store? In Chrome and Opera: Your storage is per origin (rather than per API). Both storage mechanisms will store data until the browser quota is reached. Apps can check how much quota they’re using with the Quota Management API. Firefox: no limits, but will prompt after 50MB data stored. Mobile Safari: 50MB max, Desktop Safari: unlimited (prompts after 5MB), IE10+ maxes at 250MB and prompts at 10MB. PouchDB track IDB storage behavior. Future facing: For apps requiring more persistent storage, see the on-going work on Durable Storage.

In short: It depends on the end browser.

teimurjan
  • 1,875
  • 9
  • 18