Last active
November 2, 2017 11:33
-
-
Save pierr/2c11cdd1f57d3a4276fa to your computer and use it in GitHub Desktop.
localstorageSize.js
This file contains hidden or 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
/* Process the occupied size in the local storage. | |
* @return {localstorageSize} [description] | |
*/ | |
function processLocalStorageSize() { | |
var total = 0; | |
for (var x in localStorage) { | |
total += (localStorage[x].length * 2) / 1024 / 1024; | |
//console.log(x + " = " + amount.toFixed(2) + " MB"); | |
} | |
return total.toFixed(2) + " MB"; | |
} | |
console.log(processLocalStorageSize); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment