微信小程序云开发SDK文档 文件存储删除文件


本文整理自网络,侵删。

Cloud.deleteFile(fileList: string[]): Promise<Object>

支持端:小程序 , 云函数 , Web

从云存储空间删除文件,一次最多 50 个

参数

fileList: string[]

云文件 ID 字符串数组

返回值

Promise.<Object>

属性类型说明
fileListObject文件列表

fileList 的结构

属性类型说明
fileIDstring云文件 ID
statusnumber状态码,0 为成功
errMsgstring成功为 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
}



标签:微信小程序

相关阅读 >>

微信小程序 wxs

微信小程序云开发服务端数据库api 获取集合数据

微信小程序工具 下载地址

微信小程序 小程序使用testupdateorder

微信小程序 收藏

微信小程序api nfc-mifareultralight标签

简易双向绑定

微信小程序媒体组件 image

运行机制

微信小程序api绘图addcolorstop(创建颜色渐变点)

更多相关阅读请进入《微信小程序》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...