codecamp

百度智能小程序 删除指定文件

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风格:

swan.cloud.deleteFile({
  fileList: ['test-env/my-image.png'],
  success: res => {
    console.log(res.fileList)
  },
  fail: err => {
    // ...
  }
})

Promise风格:

swan.cloud.deleteFile({
  fileList: ['test-env/my-image.png']
}).then(res => {
  console.log(res.fileList)
}).catch(err => {
  // ...
});


百度智能小程序 下载资源
百度智能小程序 获取数据库的引用
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

百度智能小程序开发文档

百度智能小程序 组件

百度智能小程序 地图

百度智能小程序 画布

百度智能小程序 API

百度智能小程序 界面

百度智能小程序 关注小程序引导组件

百度智能小程序 自定义组件

百度智能小程序 媒体

百度智能小程序 设备

百度智能小程序 拨打电话

百度智能小程序 内存警报

百度智能小程序 手机联系人

百度智能小程序 用户截屏事件

百度智能小程序 第三方平台

百度智能小程序 开放接口

百度智能小程序 百度收银支付

百度智能小程序 分包预下载

百度智能小程序 数据分析

百度智能小程序 服务端

百度智能小程序 云开发

百度智能小程序 初始化

百度智能小程序 云函数

百度智能小程序 服务端初始化

百度智能小程序 服务器获取上下文

百度智能小程序 服务端云函数

百度智能小程序 开发教程

百度智能小程序 功能开发

百度智能小程序 基本原理

百度智能小程序 小程序自动化

百度智能小程序 视频教程

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }