# wx.cloud.deleteFile

Deletes files from cloud storage. Up to 50 files can be deleted at a time.

Request parameters

Field Description Data Type Default Required
fileList Array of cloud file ID strings String[] - Y
config Configuration Object - N
success Callback succeeds
fail Callback fails
complete Callback completes

config object definition

Field Description Data Type
env ID of the used environment. Ignore the environment specified by init if this parameter is specified. String

success return parameter

Field Description Data Type
fileList List of deleted files. Each object in the list is defined below Object[]

Objects in fileList are described as follows

Field Description Data Type
fileID Cloud file ID String
status Status code. 0 means success Number
errMsg ok means success; displays cause of failure if fails String

fail return parameter

Field Description Data Type
errCode Error code Number
errMsg Error message, in the format of apiName:fail msg String

# Use Case

Callback style

wx.cloud.deleteFile({
  fileList: ['a7xzcb'],
  success: res => {
    // handle success
    console.log(res.fileList)
  },
  fail: err => {
    // handle error
  }
})

Promise style

wx.cloud.deleteFile({
  fileList: ['a7xzcb']
}).then(res => {
  // handle success
  console.log(res.fileList)
}).catch(error => {
  // handle error
})