微信小程序云开发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
}



标签:微信小程序

相关阅读 >>

目录结构

微信小程序api 绘图setstrokestyle(设置线条样式)

微信小程序api 绘图-绘制画布 drawcanvas (不推荐使用)

微信小程序设计规范(3) 便捷优雅

微信小程序 weuiform

微信小程序api 跳转到tabbar页面

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

微信小程序云开发 api数据库导出

微信小程序云开发服务端数据库api remove

微信小程序 语句

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




打赏

取消

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

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

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

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

评论

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