String compression in JavaScript

前端 未结 7 983
予麋鹿
予麋鹿 2020-11-29 00:31

I\'m looking for a JavaScript function that given a string returns a compressed (shorter) string.

I\'m developing a Chrome web application that saves long strings (H

7条回答
  •  春和景丽
    2020-11-29 00:57

    Try experimenting with textfiles before implementing anything because I think that the following does not necessarily hold:

    so I figured it would help keep the database smaller if I compressed the things it stores.

    That's because lossless compression algorithms are pretty good with repeating patterns (e.g whitespace).

提交回复
热议问题