Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I check how much space my indexedDB is taking up?

I'd like to get a breakdown of how much storage space a web app I'm working on is taking up. More specifically I'm interested in the size of data stored in indexedDB.

I know I can use navigator.storage.estimate() to get a total value, but it shows over 1 mbyte even with an empty db, and I'm interested in knowing the size of indexedDB specifically.

Is there a way to check the size?

like image 243
user2145184 Avatar asked Nov 01 '18 19:11

user2145184


1 Answers

There is not currently a standard (or even non-standard) API that gives a breakdown of storage usage by type.

  • In Chrome's DevTools, the Application tab provides a breakdown of storage by type; click the "Clear storage" view in the top left and a graph should appear. This is useful for local debugging, but not understanding storage usage "in the wild"

  • There's some discussion about extending navigator.storage.estimate() with this data at https://github.com/whatwg/storage/issues/63

UPDATE: navigator.storage.estimate() now provides a breakdown (in Chrome 75 and later) by storage type.

like image 56
Joshua Bell Avatar answered Sep 16 '22 20:09

Joshua Bell