Skip to content

Instantly share code, notes, and snippets.

@OzanKurt
Forked from JustSteveKing/localStorage.size.js
Created January 13, 2023 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OzanKurt/74ae11bf5c42fe65a08dc2076d98d3e3 to your computer and use it in GitHub Desktop.
Save OzanKurt/74ae11bf5c42fe65a08dc2076d98d3e3 to your computer and use it in GitHub Desktop.
A little script to check the size of your localStorage - for management purposes
let total = 0, amount, item;
for (item in localStorage) {
amount = ((localStorage[item].length + item.length) * 2);
total += amount;
}
console.log(`Total = ${(total / 1024).toFixed(2)}KB`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment