javascript string compression with localStorage

前端 未结 5 1589
感情败类
感情败类 2020-12-23 17:53

I am using localStorage in a project, and it will need to store lots of data, mostly of type int, bool and string. I know that javascript strings are u

5条回答
  •  孤城傲影
    2020-12-23 18:26

    You could encode to Base64 and then implement a simple lossless compression algorithm, such as run-length encoding or Golomb encoding. This shouldn't be too hard to do and might give you a bit of ompression.

    Golomb encoding

    I also found JsZip. I guess you could check the code and only use the algorithm, if it is compatible.

    Hope this helps.

    http://jszip.stuartk.co.uk/

提交回复
热议问题