微信小程序云开发服务端存储API 从云存储空间下载文件
由 Carrie 创建, 最后一次修改 2018-11-20 downloadFile从云存储空间下载文件请求参数字段说明数据类型默认值必填fileID云文件 IDString-YPromise 返回参数字段说明数据类型fileContent文件内容BufferstatusCode服务器返回的 HTTP 状态码Number错误返回参数字段说明数据类型errCode错误码NumbererrMsg错误信息,格式 apiName:fail msgString使用示例Promise 风格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')}
微信小程序云开发服务端存储API 从云存储空间下载文件