创新互联小程序教程:微信小程序云开发SDK文档文件存储·删除文件
Cloud.deleteFile(fileList: string[]): Promise
支持端:小程序 , 云函数 , Web
创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于成都网站设计、成都做网站、黔西网络推广、重庆小程序开发、黔西网络营销、黔西企业策划、黔西品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联建站为所有大学生创业者提供黔西建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com
从云存储空间删除文件,一次最多 50 个
参数
fileList: string[]
云文件 ID 字符串数组
返回值
Promise.
| 属性 | 类型 | 说明 |
|---|---|---|
| fileList | Object | 文件列表 |
fileList 的结构
| 属性 | 类型 | 说明 |
|---|---|---|
| fileID | string | 云文件 ID |
| status | number | 状态码,0 为成功 |
| errMsg | string | 成功为 ok,失败为失败原因 |
小程序端示例
Promise 风格
wx.cloud.deleteFile({
fileList: ['a7xzcb']
}).then(res => {
// handle success
console.log(res.fileList)
}).catch(error => {
// handle error
})
Callback 风格
wx.cloud.deleteFile({
fileList: ['a7xzcb'],
success: res => {
// handle success
console.log(res.fileList)
},
fail: err => {
// handle error
},
complete: res => {
// ...
}
})
云函数端示例
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})
exports.main = async (event, context) => {
const fileIDs = ['xxx', 'xxx']
const result = await cloud.deleteFile({
fileList: fileIDs,
})
return result.fileList
}
网站栏目:创新互联小程序教程:微信小程序云开发SDK文档文件存储·删除文件
本文路径:http://www.jxjierui.cn/article/cccjjjg.html


咨询
建站咨询

