Skip to main content
Version: v3+

getDataDiskInfo

Start from API_LEVEL 5.0 . Please refer to API_LEVEL.

Gets the total, available, and used capacity of the data partition (data://) in bytes. This covers the whole data partition, not the current application's storage usage. Check isSuccess before reading the capacity fields.

info

permission code: data:os.device.info

Type​

function getDataDiskInfo(): Result

Parameters​

SuccessResult​

PropertyTypeDescriptionAPI_LEVEL
isSuccesstrueThe query succeeded5.0
totalnumberTotal data partition capacity in bytes5.0
freenumberAvailable data partition capacity in bytes5.0
usednumberUsed data partition capacity in bytes5.0

FailResult​

PropertyTypeDescriptionAPI_LEVEL
isSuccessfalseThe query failed; capacity fields are not included5.0

Result​

TypeDescription
SuccessResult|FailResultundefined

Example​

import { getDataDiskInfo } from '@zos/device'

const result = getDataDiskInfo()
if (result.isSuccess) {
console.log(result.total, result.free, result.used)
}