Created
March 2, 2016 16:39
-
-
Save sardbaba/094562474332a3662f06 to your computer and use it in GitHub Desktop.
One line calculate browser local storage size.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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