欢迎光临
我们一直在努力

九八云百度小程序教程:swan.cloud.deleteFile

  • swan.cloud.deleteFile

    swan.cloud.deleteFile

    解释:删除云存储空间中的指定文件,一次最多删除 50 个。

    参数说明

    该方法的传入参数类型为对象类型,参数说明如下:

    字段 类型 必填 说明
    fileList String[] 云文件 ID
    config Object 局部覆盖 swan.cloud.init 中的全局配置
    success Function 接口调用成功的回调函数
    fail Function 接口调用失败的回调函数
    complete Function 接口调用结束的回调函数

    config参数说明:

    字段 类型 说明
    env String 使用的环境 ID,将覆盖 swan.cloud.init 指定的环境

    success返回参数说明

    字段 类型 说明
    fileList Object[] 删除结果列表,定义详见下表

    fileList参数说明:

    字段 类型 说明
    fileID String 云文件 ID
    status Number 状态码,0 为成功
    errMsg String 成功为 deleteFile:ok,失败为失败原因

    fail返回参数说明

    字段 类型 说明
    errCode Number 错误码
    errMsg String 错误信息

    代码示例

    callback风格:

    • JS
    
     
    1. swan.cloud.deleteFile({
    2. fileList: ['test-env/my-image.png'],
    3. success: res => {
    4. console.log(res.fileList)
    5. },
    6. fail: err => {
    7. // ...
    8. }
    9. })

    Promise风格:

    • JS
    
     
    1. swan.cloud.deleteFile({
    2. fileList: ['test-env/my-image.png']
    3. }).then(res => {
    4. console.log(res.fileList)
    5. }).catch(err => {
    6. // ...
    7. });

    赞(0) 打赏
    未经允许不得转载:九八云安全 » 九八云百度小程序教程:swan.cloud.deleteFile

    评论 抢沙发