简体   繁体   English

估计存储在localStorage(Javascript)中的10,000个字符串的大小

[英]Estimating the size of a 10,000 character string stored in localStorage (Javascript)

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. 我试图弄清楚在达到5mb的最大容量之前,我将能够(大概)存储多少个。

Any idea how big a 10,000 character string would be stored in localStorage? 知道将10,000个字符串存储在localStorage中有多大吗?

I'd just calculate with 20,000 bytes for 10,000 characters. 我只是用20,000个字节计算10,000个字符。 Should be a safe bet for UFT-8 and match what is needed for UTF-16 应该是UFT-8的安全押注,并与UTF-16所需的匹配

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM