当前位置:K88软件开发文章中心编程全书微信小程序 → 文章内容

微信小程序云开发服务端存储API 从云存储空间下载文件

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:03:38

由 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 从云存储空间下载文件