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?
Chrome/Edge/Opera Only: (await navigator.storage.estimate()).usageDetails
provides a breakdown by storage type, but it's not supported in Firefox/Safari (see browser compatibility).
Here is an an example of the return value of await navigator.storage.estimate()
:
{
"quota": 300562366464,
"usage": 6432044,
"usageDetails": {
"caches": 2691584,
"indexedDB": 3738459,
"serviceWorkerRegistrations": 2001
}
}
Note: The returned values are not exact: between compression, deduplication, and obfuscation for security reasons, they will be imprecise.