# FileSystemManager.fstat(Object object)
Start from base library version 2.16.1. Please remaining backward compatible.
with Promise style call: Not supported
Mini Program plugin: Support, need to Mini Program base library version no less than 2.19.2
Get status information for files
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
fd | string | yes | File descriptor. fd adopt FileSystemManager.open or FileSystemManager.openSync Interface acquisition | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# object.success callback
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
stats | Stats | Stats Object that contains the state of the file |
# object.fail callback
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
errMsg | string | Error message |
res.errMsg Legal value
value | Introductions | Minimum version |
---|---|---|
bad file descriptor | Invalid file descriptor | |
fail permission denied | Specified fd Path not read |
# sample code
const fs = wx.getFileSystemManager()
// Open the file
fs.open({
filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
flag: 'a+',
success(res) {
// Get status information for files
fs.fstat({
fd: res.fd,
success(res) {
console.log(res.stats)
}
})
}
})