getSavedFileInfo
解释:获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 getFileInfo 接口。
参数:Object
Object参数说明:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
filePath | String | 是 | 文件路径 |
success | Function | 否 | 接口调用成功的回调函数,返回结果见 success 返回参数说明。 |
fail | Function | 否 | 接口调用失败的回调函数 |
complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
size | Number | 文件大小,单位B |
createTime | Number | 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数。 |
示例:
- swan.getSavedFileInfo({
filePath: 'bdfile://somefile',
success: function (res) {
console.log(res.size);
console.log(res.createTime);
},
fail: function (err) {
console.log('错误码:' + err.errCode);
console.log('错误信息:' + err.errMsg);
}
});