// import pako from 'pako'
let pako = require('pako');
let funcTo = atob
console.log(funcTo)

const pakoObj = {
    unzip: function unzip(b64Data:any) {
        // console.log(b64Data)
        var strData = funcTo(b64Data);
        // Convert binary string to character-number array
        var charData = strData.split('').map(function(x) { return x.charCodeAt(0); });
        // console.log("charData", charData)
        // Turn number array into byte-array
        var binData = new Uint8Array(charData);
        // // unzip
        var data = pako.inflate(binData, { to: 'string' });
        return eval("(" + data + ")");
    },
    // 压缩
    zip: function(str:any) {
        //escape(str)  --->压缩前编码，防止中午乱码
        var binaryString = pako.gzip(escape(str), { to: 'string' });
        return binaryString;
    }
}

export default pakoObj