Skip to content

分片上传 ​

方法名 ​

putSuperObjectFromFile

用法 ​

  • 用法如下:
    js
    module.putSuperObjectFromFile({
      params: {
        bucket: "leven-test",
        path: "/storage/emulated/0/Download/DingTalk/2025赤壁维保遗失网关清单1.xlsx",
        objectKey: "2025赤壁维保遗失网关清单1.xlsx"
      },
      complete: (res) => {
        console.log(res)
      }
    })
    js
    module.putSuperObjectFromFile({
      params: {
        bucket: "leven-test",
        path: "/storage/emulated/0/Download/DingTalk/2025赤壁维保遗失网关清单1.xlsx",
        objectKey: "2025赤壁维保遗失网关清单1.xlsx"
      },
      complete: (res : LevenResult) => {
        console.log(res)
      }
    } as LevenOptions)
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    paramsObject是无接口请求参数
    params.bucketString是无bucket名称
    params.pathString是无上传文件路径
    params.objectKeyString是无上传后保存的文件名
    params.partSizeInteger否1024 * 1024 * 5上传的每块大小
    params.nThreadsInteger否5线程数
    successFunction否无执行成功的函数
    failFunction否无执行失败的函数
    completeFunction否无执行完成的函数,不管成功还是失败都会执行

回调 ​

  • 示例
    json
    {
        "data": {
            "type": "onProgress",
            "currentSize": 12884189,
            "uploadId": "3d1ebed969b8fee692a30a5f388b2c47A",
            "totalSize": 13695197
        },
        "message": "",
        "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    data.typeString当前处理类型,具体为:
    onProgress:上传中
    onSuccess:接口调用成功
    data.currentSizeInteger当前已上传的大小
    data.totalSizeInteger文件总大小
    data.uploadIdString当前请求id
    codeInteger返回类型,0.成功,其他:失败