docs: function compress(file, options, callback) {
      const reader = new FileReader();
      reader.onload = function (evt) {
          if(options.compress === false){
              // 不启用压缩 & base64上传 的分支，不做任何处理，直接返回文件的base64编码
              file.base64 = evt.target.result;
              callback(file);
              return;
          }
  
          // 启用压缩的分支
          const img = new Image();
          img.onload = function () {
              const ratio = detectVerticalSquash(img);
              const orientation = getOrientation(dataURItoBuffer(img.src));
              const canvas = document.createElement('canvas');
              const ctx = canvas.getContext('2d');
  
              const maxW = options.compress.width;
              const maxH = options.compress.height;
              let w = img.width;
              let h = img.height;
              let dataURL;
  
              if(w < h && h > maxH){
                  w = parseInt(maxH * img.width / img.height);
                  h = maxH;
              }else if(w >= h && w > maxW){
                  h = parseInt(maxW * img.height / img.width);
                  w = maxW;
              }
  
              canvas.width = w;
              canvas.height = h;
  
              if(orientation > 0){
                  orientationHelper(canvas, ctx, orientation);
              }
              ctx.drawImage(img, 0, 0, w, h / ratio);
  
              if(/image\/jpeg/.test(file.type) || /image\/jpg/.test(file.type)){
                  dataURL = canvas.toDataURL('image/jpeg', options.compress.quality);
              }else{
                  dataURL =  canvas.toDataURL(file.type);
              }
  
              if(options.type == 'file'){
                  if(/;base64,null/.test(dataURL) || /;base64,$/.test(dataURL)){
                      // 压缩出错，以文件方式上传的，采用原文件上传
                      console.warn('Compress fail, dataURL is ' + dataURL + '. Next will use origin file to upload.');
                      callback(file);
                  }else{
                      let blob = dataURItoBlob(dataURL);
                      blob.id = file.id;
                      blob.name = file.name;
                      blob.lastModified = file.lastModified;
                      blob.lastModifiedDate = file.lastModifiedDate;
                      callback(blob);
                  }
              }else{
                  if(/;base64,null/.test(dataURL) || /;base64,$/.test(dataURL)){
                      // 压缩失败，以base64上传的，直接报错不上传
                      options.onError(file, new Error('Compress fail, dataURL is ' + dataURL + '.'));
                      callback();
                  }else{
                      file.base64 = dataURL;
                      callback(file);
                  }
              }
          };
          img.src = evt.target.result;
      };
      reader.readAsDataURL(file);
  }