title: Taro.getStorageInfoSync()

sidebar_label: getStorageInfoSync

The synchronous version of Taro.getStorageInfo.

Reference

Type

  1. () => Option

Parameters

Option

Property Type Description
currentSize number Current space occupied (in KB)
keys string[] All keys in the current storage
limitSize number Space size limit (in KB)

Sample Code

  1. Taro.getStorageInfo({
  2. success: function (res) {
  3. console.log(res.keys)
  4. console.log(res.currentSize)
  5. console.log(res.limitSize)
  6. }
  7. })
  1. try {
  2. const res = Taro.getStorageInfoSync()
  3. console.log(res.keys)
  4. console.log(res.currentSize)
  5. console.log(res.limitSize)
  6. } catch (e) {
  7. // Do something when catch error
  8. }

API Support

API WeChat Mini-Program H5 React Native
Taro.getStorageInfoSync ✔️ ✔️