Skip to content

Instantly share code, notes, and snippets.

@sardbaba
Created March 2, 2016 16:39
Show Gist options
  • Save sardbaba/094562474332a3662f06 to your computer and use it in GitHub Desktop.
Save sardbaba/094562474332a3662f06 to your computer and use it in GitHub Desktop.
One line calculate browser local storage size.
var total = 0; for(var x in localStorage) { var amount = (localStorage[x].length*2)/1024/1024; total += amount; } console.log("Total: "+total.toFixed(10)+" MB");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment