后浪云百度小程序教程:cloud.downloadFile
- cloud.downloadFile
cloud.downloadFile
下载云存储文件
参数
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| option | Object | 是 | |
| option.fileID | String | 是 | 文件 ID |
返回值 Promise
resolve 参数:
| 名称 | 类型 | 说明 |
|---|---|---|
| requestID | String | 请求 ID |
| fileContent | buffer | 文件内容 |
reject 参数:
| 名称 | 类型 | 说明 |
|---|---|---|
| code | String | 错误码 |
| message | String | 错误信息 |
代码示例
const cloud = require('swan-server-sdk')exports.main = async (event, context) => {cloud.init(context)const res = await cloud.downloadFile({fileID: 'file-id-01',})return res.fileContent}
版权声明:
作者:后浪云
链接:https://idc.net/help/186235/
文章版权归作者所有,未经允许请勿转载。
THE END
