0

I am building an application that allows for a finite amount of local storage. I am snagging the text from a web-page and storing it in local storage. I am trying to figure out how many of these I will be able to store (roughly) before hitting my max of 5mb.

Any idea how big a 10,000 character string would be stored in localStorage?

user417669
  • 168
  • 2
  • 15
  • 1
    try this http://stackoverflow.com/questions/3027142/calculating-usage-of-localstorage-space – charlietfl Nov 11 '13 at 01:09
  • You might want to look at http://stackoverflow.com/questions/5290182/how-many-bytes-takes-one-unicode-character. But if one character takes up 1 byte as Yahoo Answers says, you can store 5,243,000 characters until you get to 5MB, and 10,000 characters would take up 0.009536743MB. So I think you're pretty safe. Yahoo Answers also says that a unicode character takes up 2 bytes. – Sheng Slogar Nov 11 '13 at 01:16
  • great info, thanks for the link. – user417669 Nov 11 '13 at 01:16

1 Answers1

3

I'd just calculate with 20,000 bytes for 10,000 characters. Should be a safe bet for UFT-8 and match what is needed for UTF-16

Stefan Haustein
  • 17,024
  • 3
  • 30
  • 45
  • so if your estimations are correct, it seems that I could store around 262 of these bad boys before hitting 5mb. – user417669 Nov 11 '13 at 01:16