161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (C) 2022-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit CoreFileKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Provides filesystem statistics APIs. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace storageStatistics 2761847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 2861847f8eSopenharmony_ci * @since 8 2961847f8eSopenharmony_ci */ 3061847f8eSopenharmony_cideclare namespace storageStatistics { 3161847f8eSopenharmony_ci /** 3261847f8eSopenharmony_ci * Get the total size of volume. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 3561847f8eSopenharmony_ci * @param { string } volumeUuid - The uuid of the volume 3661847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - callback 3761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 3861847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 3961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 4061847f8eSopenharmony_ciparameters are left unspecified; 4161847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 4261847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 4361847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 4461847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 4561847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 4661847f8eSopenharmony_ci * @systemapi 4761847f8eSopenharmony_ci * @since 8 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_ci function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void; 5061847f8eSopenharmony_ci 5161847f8eSopenharmony_ci /** 5261847f8eSopenharmony_ci * Get the total size of volume. 5361847f8eSopenharmony_ci * 5461847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 5561847f8eSopenharmony_ci * @param { string } volumeUuid - The uuid of the volume 5661847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 5761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 5861847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 5961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 6061847f8eSopenharmony_ciparameters are left unspecified; 6161847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 6261847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 6361847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 6461847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 6561847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 6661847f8eSopenharmony_ci * @systemapi 6761847f8eSopenharmony_ci * @since 8 6861847f8eSopenharmony_ci */ 6961847f8eSopenharmony_ci function getTotalSizeOfVolume(volumeUuid: string): Promise<number>; 7061847f8eSopenharmony_ci /** 7161847f8eSopenharmony_ci * Get the free size of volume. 7261847f8eSopenharmony_ci * 7361847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 7461847f8eSopenharmony_ci * @param { string } volumeUuid - The uuid of the volume 7561847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - callback 7661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 7761847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 7861847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 7961847f8eSopenharmony_ciparameters are left unspecified; 8061847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 8161847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 8261847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 8361847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 8461847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 8561847f8eSopenharmony_ci * @systemapi 8661847f8eSopenharmony_ci * @since 8 8761847f8eSopenharmony_ci */ 8861847f8eSopenharmony_ci function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void; 8961847f8eSopenharmony_ci 9061847f8eSopenharmony_ci /** 9161847f8eSopenharmony_ci * Get the free size of volume. 9261847f8eSopenharmony_ci * 9361847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 9461847f8eSopenharmony_ci * @param { string } volumeUuid - The uuid of the volume 9561847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 9661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 9761847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 9861847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 9961847f8eSopenharmony_ciparameters are left unspecified; 10061847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 10161847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 10261847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 10361847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 10461847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 10561847f8eSopenharmony_ci * @systemapi 10661847f8eSopenharmony_ci * @since 8 10761847f8eSopenharmony_ci */ 10861847f8eSopenharmony_ci function getFreeSizeOfVolume(volumeUuid: string): Promise<number>; 10961847f8eSopenharmony_ci 11061847f8eSopenharmony_ci /** 11161847f8eSopenharmony_ci * Get the bundle statistics. 11261847f8eSopenharmony_ci * 11361847f8eSopenharmony_ci * @interface BundleStats 11461847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 11561847f8eSopenharmony_ci * @since 9 11661847f8eSopenharmony_ci */ 11761847f8eSopenharmony_ci export interface BundleStats { 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * The size of application installation data. 12061847f8eSopenharmony_ci * 12161847f8eSopenharmony_ci * @type { number } 12261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 12361847f8eSopenharmony_ci * @since 9 12461847f8eSopenharmony_ci */ 12561847f8eSopenharmony_ci appSize: number; 12661847f8eSopenharmony_ci 12761847f8eSopenharmony_ci /** 12861847f8eSopenharmony_ci * The size of application cache data. 12961847f8eSopenharmony_ci * 13061847f8eSopenharmony_ci * @type { number } 13161847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 13261847f8eSopenharmony_ci * @since 9 13361847f8eSopenharmony_ci */ 13461847f8eSopenharmony_ci cacheSize: number; 13561847f8eSopenharmony_ci 13661847f8eSopenharmony_ci /** 13761847f8eSopenharmony_ci * The size of application local data, distributed data and database data. 13861847f8eSopenharmony_ci * 13961847f8eSopenharmony_ci * @type { number } 14061847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 14161847f8eSopenharmony_ci * @since 9 14261847f8eSopenharmony_ci */ 14361847f8eSopenharmony_ci dataSize: number; 14461847f8eSopenharmony_ci } 14561847f8eSopenharmony_ci /** 14661847f8eSopenharmony_ci * Get the bundle statistics. 14761847f8eSopenharmony_ci * 14861847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 14961847f8eSopenharmony_ci * @param { string } packageName - The name of the application 15061847f8eSopenharmony_ci * @param { AsyncCallback<BundleStats> } callback - callback 15161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 15261847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 15361847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 15461847f8eSopenharmony_ciparameters are left unspecified; 15561847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 15661847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 15761847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 15861847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 15961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 16061847f8eSopenharmony_ci * @systemapi 16161847f8eSopenharmony_ci * @since 9 16261847f8eSopenharmony_ci */ 16361847f8eSopenharmony_ci /** 16461847f8eSopenharmony_ci * Get the bundle statistics. 16561847f8eSopenharmony_ci * 16661847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 16761847f8eSopenharmony_ci * @param { string } packageName - The name of the application 16861847f8eSopenharmony_ci * @param { AsyncCallback<BundleStats> } callback - callback 16961847f8eSopenharmony_ci * @param { number } index - The index number of the clone application, the default value is 0. 17061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 17161847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 17261847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid. 17361847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 17461847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 17561847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 17661847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 17761847f8eSopenharmony_ci * @systemapi 17861847f8eSopenharmony_ci * @since 12 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci function getBundleStats(packageName: string, callback: AsyncCallback<BundleStats>, index?: number): void; 18161847f8eSopenharmony_ci 18261847f8eSopenharmony_ci /** 18361847f8eSopenharmony_ci * Get the bundle statistics. 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 18661847f8eSopenharmony_ci * @param { string } packageName - The name of the application 18761847f8eSopenharmony_ci * @returns { Promise<BundleStats> } return Promise 18861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 18961847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 19061847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 19161847f8eSopenharmony_ciparameters are left unspecified; 19261847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 19361847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 19461847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 19561847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 19661847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 19761847f8eSopenharmony_ci * @systemapi 19861847f8eSopenharmony_ci * @since 9 19961847f8eSopenharmony_ci */ 20061847f8eSopenharmony_ci /** 20161847f8eSopenharmony_ci * Get the bundle statistics. 20261847f8eSopenharmony_ci * 20361847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 20461847f8eSopenharmony_ci * @param { string } packageName - The name of the application 20561847f8eSopenharmony_ci * @param { number } index - The index number of the clone application, the default value is 0. 20661847f8eSopenharmony_ci * @returns { Promise<BundleStats> } return Promise 20761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 20861847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 20961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid. 21061847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 21161847f8eSopenharmony_ci * @throws { BusinessError } 13600008 - No such object. 21261847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 21361847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 21461847f8eSopenharmony_ci * @systemapi 21561847f8eSopenharmony_ci * @since 12 21661847f8eSopenharmony_ci */ 21761847f8eSopenharmony_ci function getBundleStats(packageName: string, index?: number): Promise<BundleStats>; 21861847f8eSopenharmony_ci 21961847f8eSopenharmony_ci /** 22061847f8eSopenharmony_ci * Get the current bundle statistics. 22161847f8eSopenharmony_ci * 22261847f8eSopenharmony_ci * @param { AsyncCallback<BundleStats> } callback - callback 22361847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 22461847f8eSopenharmony_ciparameters are left unspecified; 22561847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 22661847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 22761847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 22861847f8eSopenharmony_ci * @since 9 22961847f8eSopenharmony_ci */ 23061847f8eSopenharmony_ci function getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void; 23161847f8eSopenharmony_ci 23261847f8eSopenharmony_ci /** 23361847f8eSopenharmony_ci * Get the current bundle statistics. 23461847f8eSopenharmony_ci * 23561847f8eSopenharmony_ci * @returns { Promise<BundleStats> } return Promise 23661847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 23761847f8eSopenharmony_ciparameters are left unspecified; 23861847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 23961847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 24061847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 24161847f8eSopenharmony_ci * @since 9 24261847f8eSopenharmony_ci */ 24361847f8eSopenharmony_ci function getCurrentBundleStats(): Promise<BundleStats>; 24461847f8eSopenharmony_ci 24561847f8eSopenharmony_ci /** 24661847f8eSopenharmony_ci * Get the system size. 24761847f8eSopenharmony_ci * 24861847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 24961847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - callback 25061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 25161847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 25261847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 25361847f8eSopenharmony_ciparameters are left unspecified; 25461847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 25561847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 25661847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 25761847f8eSopenharmony_ci * @systemapi 25861847f8eSopenharmony_ci * @since 9 25961847f8eSopenharmony_ci */ 26061847f8eSopenharmony_ci function getSystemSize(callback: AsyncCallback<number>): void; 26161847f8eSopenharmony_ci 26261847f8eSopenharmony_ci /** 26361847f8eSopenharmony_ci * Get the system size. 26461847f8eSopenharmony_ci * 26561847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 26661847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 26761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 26861847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 26961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 27061847f8eSopenharmony_ciparameters are left unspecified; 27161847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 27261847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 27361847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 27461847f8eSopenharmony_ci * @systemapi 27561847f8eSopenharmony_ci * @since 9 27661847f8eSopenharmony_ci */ 27761847f8eSopenharmony_ci function getSystemSize(): Promise<number>; 27861847f8eSopenharmony_ci 27961847f8eSopenharmony_ci /** 28061847f8eSopenharmony_ci * Get the user storage statistics. 28161847f8eSopenharmony_ci * 28261847f8eSopenharmony_ci * @interface StorageStats 28361847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 28461847f8eSopenharmony_ci * @systemapi 28561847f8eSopenharmony_ci * @since 9 28661847f8eSopenharmony_ci */ 28761847f8eSopenharmony_ci export interface StorageStats { 28861847f8eSopenharmony_ci /** 28961847f8eSopenharmony_ci * The total size of device. 29061847f8eSopenharmony_ci * 29161847f8eSopenharmony_ci * @type { number } 29261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 29361847f8eSopenharmony_ci * @systemapi 29461847f8eSopenharmony_ci * @since 9 29561847f8eSopenharmony_ci */ 29661847f8eSopenharmony_ci total: number; 29761847f8eSopenharmony_ci 29861847f8eSopenharmony_ci /** 29961847f8eSopenharmony_ci * The size of audio file. 30061847f8eSopenharmony_ci * 30161847f8eSopenharmony_ci * @type { number } 30261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 30361847f8eSopenharmony_ci * @systemapi 30461847f8eSopenharmony_ci * @since 9 30561847f8eSopenharmony_ci */ 30661847f8eSopenharmony_ci audio: number; 30761847f8eSopenharmony_ci 30861847f8eSopenharmony_ci /** 30961847f8eSopenharmony_ci * The size of video file. 31061847f8eSopenharmony_ci * 31161847f8eSopenharmony_ci * @type { number } 31261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 31361847f8eSopenharmony_ci * @systemapi 31461847f8eSopenharmony_ci * @since 9 31561847f8eSopenharmony_ci */ 31661847f8eSopenharmony_ci video: number; 31761847f8eSopenharmony_ci 31861847f8eSopenharmony_ci /** 31961847f8eSopenharmony_ci * The size of image file. 32061847f8eSopenharmony_ci * 32161847f8eSopenharmony_ci * @type { number } 32261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 32361847f8eSopenharmony_ci * @systemapi 32461847f8eSopenharmony_ci * @since 9 32561847f8eSopenharmony_ci */ 32661847f8eSopenharmony_ci image: number; 32761847f8eSopenharmony_ci 32861847f8eSopenharmony_ci /** 32961847f8eSopenharmony_ci * The size of other file. 33061847f8eSopenharmony_ci * 33161847f8eSopenharmony_ci * @type { number } 33261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 33361847f8eSopenharmony_ci * @systemapi 33461847f8eSopenharmony_ci * @since 9 33561847f8eSopenharmony_ci */ 33661847f8eSopenharmony_ci file: number; 33761847f8eSopenharmony_ci 33861847f8eSopenharmony_ci /** 33961847f8eSopenharmony_ci * The size of application. 34061847f8eSopenharmony_ci * 34161847f8eSopenharmony_ci * @type { number } 34261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 34361847f8eSopenharmony_ci * @systemapi 34461847f8eSopenharmony_ci * @since 9 34561847f8eSopenharmony_ci */ 34661847f8eSopenharmony_ci app: number; 34761847f8eSopenharmony_ci } 34861847f8eSopenharmony_ci 34961847f8eSopenharmony_ci /** 35061847f8eSopenharmony_ci * Get the user storage statistics. 35161847f8eSopenharmony_ci * 35261847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 35361847f8eSopenharmony_ci * @returns { Promise<StorageStats> } return Promise 35461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 35561847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 35661847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 35761847f8eSopenharmony_ciparameters are left unspecified; 35861847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 35961847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 36061847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 36161847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 36261847f8eSopenharmony_ci * @systemapi 36361847f8eSopenharmony_ci * @since 9 36461847f8eSopenharmony_ci */ 36561847f8eSopenharmony_ci function getUserStorageStats(): Promise<StorageStats>; 36661847f8eSopenharmony_ci 36761847f8eSopenharmony_ci /** 36861847f8eSopenharmony_ci * Get the user storage statistics. 36961847f8eSopenharmony_ci * 37061847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 37161847f8eSopenharmony_ci * @param { AsyncCallback<StorageStats> } callback - callback 37261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 37361847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 37461847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 37561847f8eSopenharmony_ciparameters are left unspecified; 37661847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 37761847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 37861847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 37961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 38061847f8eSopenharmony_ci * @systemapi 38161847f8eSopenharmony_ci * @since 9 38261847f8eSopenharmony_ci */ 38361847f8eSopenharmony_ci function getUserStorageStats(callback: AsyncCallback<StorageStats>): void; 38461847f8eSopenharmony_ci 38561847f8eSopenharmony_ci /** 38661847f8eSopenharmony_ci * Get the user storage statistics. 38761847f8eSopenharmony_ci * 38861847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 38961847f8eSopenharmony_ci * @param { number } userId - The id of the user 39061847f8eSopenharmony_ci * @returns { Promise<StorageStats> } return Promise 39161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 39261847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 39361847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 39461847f8eSopenharmony_ciparameters are left unspecified; 39561847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 39661847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 39761847f8eSopenharmony_ci * @throws { BusinessError } 13600009 - User if out of range. 39861847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 39961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 40061847f8eSopenharmony_ci * @systemapi 40161847f8eSopenharmony_ci * @since 9 40261847f8eSopenharmony_ci */ 40361847f8eSopenharmony_ci function getUserStorageStats(userId: number): Promise<StorageStats>; 40461847f8eSopenharmony_ci 40561847f8eSopenharmony_ci /** 40661847f8eSopenharmony_ci * Get the user storage statistics. 40761847f8eSopenharmony_ci * 40861847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 40961847f8eSopenharmony_ci * @param { number } userId - The id of the user 41061847f8eSopenharmony_ci * @param { AsyncCallback<StorageStats> } callback - callback 41161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 41261847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 41361847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory 41461847f8eSopenharmony_ciparameters are left unspecified; 41561847f8eSopenharmony_ci * <br>2.Incorrect parameter types. 41661847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 41761847f8eSopenharmony_ci * @throws { BusinessError } 13600009 - User if out of range. 41861847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 41961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 42061847f8eSopenharmony_ci * @systemapi 42161847f8eSopenharmony_ci * @since 9 42261847f8eSopenharmony_ci */ 42361847f8eSopenharmony_ci function getUserStorageStats(userId: number, callback: AsyncCallback<StorageStats>): void; 42461847f8eSopenharmony_ci 42561847f8eSopenharmony_ci /** 42661847f8eSopenharmony_ci * Get the total size. 42761847f8eSopenharmony_ci * 42861847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 42961847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - callback 43061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 43161847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 43261847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 43361847f8eSopenharmony_ciparameters are left unspecified; 43461847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 43561847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 43661847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 43761847f8eSopenharmony_ci * @systemapi 43861847f8eSopenharmony_ci * @since 9 43961847f8eSopenharmony_ci */ 44061847f8eSopenharmony_ci function getTotalSize(callback: AsyncCallback<number>): void; 44161847f8eSopenharmony_ci 44261847f8eSopenharmony_ci /** 44361847f8eSopenharmony_ci * Get the total size. 44461847f8eSopenharmony_ci * 44561847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 44661847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 44761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 44861847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 44961847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 45061847f8eSopenharmony_ciparameters are left unspecified; 45161847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 45261847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 45361847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 45461847f8eSopenharmony_ci * @systemapi 45561847f8eSopenharmony_ci * @since 9 45661847f8eSopenharmony_ci */ 45761847f8eSopenharmony_ci function getTotalSize(): Promise<number>; 45861847f8eSopenharmony_ci 45961847f8eSopenharmony_ci /** 46061847f8eSopenharmony_ci * Get the total size with sync interface 46161847f8eSopenharmony_ci * 46261847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 46361847f8eSopenharmony_ci * @returns { number } return the total size 46461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 46561847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 46661847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 46761847f8eSopenharmony_ciparameters are left unspecified; 46861847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 46961847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 47061847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 47161847f8eSopenharmony_ci * @systemapi 47261847f8eSopenharmony_ci * @since 10 47361847f8eSopenharmony_ci */ 47461847f8eSopenharmony_ci function getTotalSizeSync(): number; 47561847f8eSopenharmony_ci 47661847f8eSopenharmony_ci /** 47761847f8eSopenharmony_ci * Get the free size. 47861847f8eSopenharmony_ci * 47961847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 48061847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - callback 48161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 48261847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 48361847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 48461847f8eSopenharmony_ciparameters are left unspecified; 48561847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 48661847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 48761847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 48861847f8eSopenharmony_ci * @systemapi 48961847f8eSopenharmony_ci * @since 9 49061847f8eSopenharmony_ci */ 49161847f8eSopenharmony_ci function getFreeSize(callback: AsyncCallback<number>): void; 49261847f8eSopenharmony_ci 49361847f8eSopenharmony_ci /** 49461847f8eSopenharmony_ci * Get the free size. 49561847f8eSopenharmony_ci * 49661847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 49761847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 49861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 49961847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 50061847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 50161847f8eSopenharmony_ciparameters are left unspecified; 50261847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 50361847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 50461847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 50561847f8eSopenharmony_ci * @systemapi 50661847f8eSopenharmony_ci * @since 9 50761847f8eSopenharmony_ci */ 50861847f8eSopenharmony_ci function getFreeSize(): Promise<number>; 50961847f8eSopenharmony_ci 51061847f8eSopenharmony_ci /** 51161847f8eSopenharmony_ci * Get the free size with sync interface. 51261847f8eSopenharmony_ci * 51361847f8eSopenharmony_ci * @permission ohos.permission.STORAGE_MANAGER 51461847f8eSopenharmony_ci * @returns { number } return the free size 51561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. 51661847f8eSopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 51761847f8eSopenharmony_ci * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory 51861847f8eSopenharmony_ciparameters are left unspecified; 51961847f8eSopenharmony_ci * @throws { BusinessError } 13600001 - IPC error. 52061847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error. 52161847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics 52261847f8eSopenharmony_ci * @systemapi 52361847f8eSopenharmony_ci * @since 10 52461847f8eSopenharmony_ci */ 52561847f8eSopenharmony_ci function getFreeSizeSync(): number; 52661847f8eSopenharmony_ci} 52761847f8eSopenharmony_ci 52861847f8eSopenharmony_ciexport default storageStatistics; 529