# wx.getStorageInfo(Object object)
with Promise style call: Supported
Mini Program plugin: Not supported
Gets information about the current storage asynchronously. Cache related policies to view storage。
# parameter
# Object object
| attribute | type | Default values | Required | Introductions |
|---|---|---|---|---|
| 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 object
| attribute | type | Introductions |
|---|---|---|
| keys | Array.<string> | Current storage All of the key |
| currentSize | number | The current amount of space occupied, unit KB |
| limitSize | number | Limited space size, unit KB |
# sample code
wx.getStorageInfo({
success (res) {
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
}
})
try {
const res = wx.getStorageInfoSync()
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
} catch (and) {
// From the something when catch error
}