docs: function tinf_uncompress(source, dest) {
    var d = new Data(source, dest);
    var bfinal, btype, res;
  
    do {
      /* read final block flag */
      bfinal = tinf_getbit(d);
  
      /* read block type (2 bits) */
      btype = tinf_read_bits(d, 2, 0);
  
      /* decompress block */
      switch (btype) {
        case 0:
          /* decompress uncompressed block */
          res = tinf_inflate_uncompressed_block(d);
          break;
        case 1:
          /* decompress block with fixed huffman trees */
          res = tinf_inflate_block_data(d, sltree, sdtree);
          break;
        case 2:
          /* decompress block with dynamic huffman trees */
          tinf_decode_trees(d, d.ltree, d.dtree);
          res = tinf_inflate_block_data(d, d.ltree, d.dtree);
          break;
        default:
          res = TINF_DATA_ERROR;
      }
  
      if (res !== TINF_OK)
        throw new Error('Data error');
  
    } while (!bfinal);
  
    if (d.destLen < d.dest.length) {
      if (typeof d.dest.slice === 'function')
        return d.dest.slice(0, d.destLen);
      else
        return d.dest.subarray(0, d.destLen);
    }
    
    return d.dest;
  }