- swan.getSavedFileList
- 方法参数
- object 参数说明
- success 返回参数说明
- fileList 中的项目说明
- 示例
- 图片示例
- 代码示例
- 错误码
- Android
- Android
- 方法参数
swan.getSavedFileList
解释:获取本地已保存的文件列表
Web 态说明: 受浏览器限制,Web 态不支持文件系统相关功能,调用该方法会执行失败回调函数。
方法参数
Object object
object 参数说明
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
|
success |
Function |
否 |
接口调用成功的回调函数,返回结果见 success 返回参数说明 |
|
|
fail |
Function |
否 |
接口调用失败的回调函数 |
|
|
complete |
Function |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
success 返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
|
fileList |
Array.<object> |
文件列表 |
fileList 中的项目说明
| 参数名 | 类型 | 说明 |
|---|---|---|
|
filePath |
String |
文件的本地路径 |
|
createTime |
Number |
文件的保存时的时间戳,从 1970/01/01 08:00:00 到当前时间的秒数 |
|
size |
Number |
文件大小(单位:B) |
示例
跳转编辑工具
在开发者工具中打开
在 WEB IDE 中打开
扫码体验
代码示例
请使用百度APP扫码
图片示例
代码示例
- SWAN
- JS
<view class="wrap"><view class="card-area"><view class="display-area"><image class="display-area-image" src="https://b.bdstatic.com/searchbox/icms/searchbox/img/file-pdf.png" mode="widthFix"></image><view class="title">示例文件.pdf</view></view><button type="primary" bindtap="saveFile">保存文件</button><button type="primary" bindtap="getSavedFileList">获取已保存文件列表信息</button></view></view>
错误码
Android
| 错误码 | 说明 |
|---|---|
|
1001 |
执行失败 |
|
2003 |
IO 异常 |


![晴川云Minecraft Wiki教程:初始资源[ ],晴川云](https://baike.qcidc.com/wp-content/uploads/2025/09/20250919082132480-u_1941348588_832400617fm_253fmt_autoapp_138f_GIF.gif)







暂无评论内容