使用JavaScript将压缩文本文件加载到字符串中


Load compressed text file into a String using JavaScript

可能重复:
使用JavaScript 解压缩文件

如果我有一个简单的压缩文本文件(在.zip/.rar/…文件中),并且我想用JavaScript将其读取为字符串,我该怎么办?

换句话说,如果我压缩的test.txt文件的内容是"Hello world",那么我应该怎么做才能将这个"Hello word"文本复制到字符串中?

如何做到这一点?我应该使用哪种压缩格式(.zip/.rar/other)?

提前谢谢!

假设您成功地将压缩文件加载到javascript变量(通过AJAX?),请遵循以下类似的问题进行解压缩:

解压缩文件

尝试使用zip.js:http://gildas-lormeau.github.com/zip.js/

示例:http://gildas-lormeau.github.com/zip.js/demos/demo2.html