# downloadFile

Downloads files from cloud storage.

Request parameters

Field Description Data Type Default Required
fileID Cloud file ID String - Y

Promise return parameter

Field Description Data Type
fileContent File content Buffer
statusCode HTTP status code returned by the server Number

Error return parameter

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

# Use Case

Promise style

const cloud = require('wx-server-sdk')

exports.main = async (event, context) => {
  const fileID = 'xxxx'
  const res = await cloud.downloadFile({
    fileID: fileID,
  })
  const buffer = res.fileContent
  return buffer.toString('utf8')
}