Skip to main content
Version: Next

Taro.getStorageInfoSync()

The synchronous version of Taro.getStorageInfo.

Reference

Type

() => Option

Parameters

Option

PropertyTypeDescription
currentSizenumberCurrent space occupied (in KB)
keysstring[]All keys in the current storage
limitSizenumberSpace size limit (in KB)

Sample Code

Taro.getStorageInfo({
success: function (res) {
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
}
})
try {
const res = Taro.getStorageInfoSync()
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
} catch (e) {
// Do something when catch error
}

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getStorageInfoSync✔️✔️