deleteFile

从云存储空间删除文件

请求参数

字段 说明 数据类型 默认值 必填
fileList 云文件 ID 字符串数组 String[] - Y

Promise 返回参数

字段 说明 数据类型
fileList 删除结果列表,列表中的每一个对象的定义见下表 Object[]

fileList 列表中的对象说明

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

错误返回参数

字段 说明 数据类型
errCode 错误码 Number
errMsg 错误信息,格式 apiName:fail msg String

使用示例

  1. const cloud = require('wx-server-sdk')
  2. exports.main = async (event, context) => {
  3. const fileIDs = ['xxx', 'xxx']
  4. const result = await cloud.deleteFile({
  5. fileList: fileIDs,
  6. })
  7. return result.fileList
  8. }

原文: https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-server-api/storage/deleteFile.html