mdict-parser.js
function(len, expectedBufSize, decryptor) {
          var comp_type = dv.getUint8(offset, false);  // compression type, 0 = non, 1 = lzo, 2 = gzip
          if (comp_type === 0) {
            if (_v2) {
              this.forward(8);  // for version >= 2, skip comp_type (4 bytes with tailing \x00) and checksum (4 bytes)
            }
            return this;
          } else {
            // skip comp_type (4 bytes with tailing \x00) and checksum (4 bytes)
            offset += 8; len -= 8;
            var tmp = new Uint8Array(len);
            buf.copy(tmp, 0, offset, offset + len);
            if (decryptor) {
              var passkey = new Uint8Array(8);
              var q = new Buffer(4);
              buf.copy(passkey, 0, offset-4, offset);
              // var q = new Buffer(4);
              passkey.set([0x95, 0x36, 0x00, 0x00], 4);         // key part 2: fixed data
              tmp = decryptor(tmp, passkey);
            }            
            tmp = comp_type === 2 ? pako.inflate(tmp) : lzo.decompress(tmp, expectedBufSize, 1308672);
            this.forward(len);
            var d = new Buffer(tmp);
            return Scanner(d, tmp.length);
          }
        }
function(len, expectedBufSize, decryptor) {
          var comp_type = dv.getUint8(offset, false);  // compression type, 0 = non, 1 = lzo, 2 = gzip
          if (comp_type === 0) {
            if (_v2) {
              this.forward(8);  // for version >= 2, skip comp_type (4 bytes with tailing \x00) and checksum (4 bytes)
            }
            return this;
          } else {
            // skip comp_type (4 bytes with tailing \x00) and checksum (4 bytes)
            offset += 8; len -= 8;
            var tmp = new Uint8Array(len);
            buf.copy(tmp, 0, offset, offset + len);
            if (decryptor) {
              var passkey = new Uint8Array(8);
              var q = new Buffer(4);
              buf.copy(passkey, 0, offset-4, offset);
              // var q = new Buffer(4);
              passkey.set([0x95, 0x36, 0x00, 0x00], 4);         // key part 2: fixed data
              tmp = decryptor(tmp, passkey);
            }            
            tmp = comp_type === 2 ? pako.inflate(tmp) : lzo.decompress(tmp, expectedBufSize, 1308672);
            this.forward(len);
            var d = new Buffer(tmp);
            return Scanner(d, tmp.length);
          }
        }
Read data block of keyword index, key block or record content. These data block are maybe in compressed (gzip or lzo) format, while keyword index maybe be encrypted. @see https://github.com/zhansliu/writemdict/blob/master/fileformat.md#compression (with typo mistake)