# wx.getFileInfo(Object object)
Start from base library version 1.4.0. Please remaining backward compatible.
with Promise style call: Supported
Mini Program plugin: Not supported
Get File Information
# parameter
# Object object
| attribute | type | Default values | Required | Introductions |
|---|---|---|---|---|
| filePath | string | yes | Local file path (本地路径) | |
| digestAlgorithm | string | 'md5' | no | Algorithm for computing file summaries |
| 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.digestAlgorithm Legal value
| value | Introductions | Minimum version |
|---|---|---|
| md5 | md5 algorithm | |
| sha1 | sha1 algorithm |
# object.success callback
# parameter
# Object res
| attribute | type | Introductions |
|---|---|---|
| size | number | File size, in bytes |
| digest | string | According to the incoming digestAlgorithm Summary of calculated documents |
# sample code
wx.getFileInfo({
success (res) {
console.log(res.size)
console.log(res.digest)
}
})