class Compressor{
    constructor(){
        this._zz=require('zlibjs');
    }
    Compress(originStr){
        let originBuffer = new Buffer(originStr, 'utf8');
        return new this._zz.deflateSync(originBuffer).toString('base64');
    }
    Decompress(deflatedStr){
        let buffer = new Buffer(deflatedStr, 'base64');
        return (new this._zz.inflateSync(buffer)).toString();
    }
}

module.exports=Compressor;