code: function decompress(data) {
      var input = new Uint8Array(data);
      var output = [];
  
      var ip = 0;
      var op = 0;
  
      do {
          var ctrl = input[ip++];
  
          if (ctrl < (1 << 5)) { /* literal run */
              ctrl++;
  
              if (ip + ctrl > input.length) {
                  throw new Error('Invalid input'); 
              }
  
              while (ctrl--) {
                  output[op++] = input[ip++];
              }
          } else { /* back reference */
              var len = ctrl >> 5;
              var ref =  op - ((ctrl & 0x1f) << 8) - 1;
  
              if (ip >= input.length) {
                  throw new Error('Invalid input');
              }
  
              if (len == 7) {
                  len += input[ip++];
  
                  if (ip >= input.length) {
                      throw new Error('Invalid input');
                  }
              }
  
              ref -= input[ip++];
  
              if (ref < 0) {
                  throw new Error('Invalid input');
              }
  
              len += 2;
  
              do {
                  output[op++] = output[ref++];
              } while (--len);
          }
      } while (ip < input.length);
  
      // Return a Buffer if it exists (say in node), otherwise just
      // use a normal Uint8Array.
      if (typeof Buffer !== 'undefined') {
          return new Buffer(output);
      } else {
          var res = new Uint8Array(output.length);
          res.set(output);
          return res;
      }
  }
docs: Decompress a TypedArray (in browser) or Buffer (in node)
  containing LZF compressed data.
  @param {(ArrayBuffer|TypedArray|Buffer)} data - the data to be decompressed
  @returns {(Uint8Array|Buffer)} - decompressed data