【前端】pako库——数据压缩利器工具
pako.deflate()压缩,压缩为UInt8Array
pako.inflate()解压缩
let jsonObj = {"a":1,"b":"123"};
let jsonStr = JSON.stringify(jsonObj);
let compressed = pako.deflate(jsonStr);
console.log(compressed);
let decompressed = pako.inflate(compressed,{to:'string'});
console.log(decompressed);
运行结果: