mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 15:09:48 +00:00
commit
4695988717
@ -1,144 +1,418 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { AsyncCallback } from './basic';
|
||||
import type { AsyncCallback } from './@ohos.base';
|
||||
|
||||
/**
|
||||
* Provides filesystem statistics APIs
|
||||
*
|
||||
* @since 8
|
||||
* @namespace storageStatistics
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
declare namespace storageStatistics {
|
||||
/**
|
||||
* Get the totalSize of volume.
|
||||
*
|
||||
* @since 8
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } volumeUuid The uuid of the volume
|
||||
* @param { AsyncCallback<number> } callback The callback is used to return the total size of volume
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Get the totalSize of volume.
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } volumeUuid The uuid of the volume
|
||||
* @returns { Promise<number> } Return total size of volume
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getTotalSizeOfVolume(volumeUuid: string): Promise<number>;
|
||||
/**
|
||||
* Get the free size Of volume.
|
||||
*
|
||||
* @since 8
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } volumeUuid The uuid of the volume
|
||||
* @param { AsyncCallback<number> } callback The callback is used to return the free size of volume
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Get the free size Of volume.
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } volumeUuid The uuid of the volume
|
||||
* @returns { Promise<number> } Return free size of volume
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getFreeSizeOfVolume(volumeUuid: string): Promise<number>;
|
||||
|
||||
/**
|
||||
* Get the bundlestat
|
||||
*
|
||||
* @since 9
|
||||
* @interface BundleStats
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
|
||||
export interface BundleStats {
|
||||
/**
|
||||
* The size of application installation data.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @since 9
|
||||
*/
|
||||
appSize: number;
|
||||
|
||||
/**
|
||||
* The size of application cache data.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @since 9
|
||||
*/
|
||||
cacheSize: number;
|
||||
|
||||
/**
|
||||
* The size of application local data, distributed data and database data.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @since 9
|
||||
*/
|
||||
dataSize: number;
|
||||
}
|
||||
/**
|
||||
* Get the bundlestat
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } packageName The name of the application
|
||||
* @param { AsyncCallback<BundleStats> } callback The callback is used to return bundleStats of application
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getBundleStats(packageName: string, callback: AsyncCallback<BundleStats>): void;
|
||||
|
||||
/**
|
||||
* Get the bundlestat
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } packageName The name of the application
|
||||
* @returns { Promise<BundleStats> } Return bundleStats of application
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getBundleStats(packageName: string): Promise<BundleStats>;
|
||||
|
||||
/**
|
||||
* Get the CurrentBundleStats
|
||||
* Get the Current BundleStats
|
||||
*
|
||||
* @since 9
|
||||
* @param { AsyncCallback<BundleStats> } callback The callback is used to return bundleStats of the current application
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @since 9
|
||||
*/
|
||||
function getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void;
|
||||
|
||||
/**
|
||||
* Get the Current BundleStats
|
||||
*
|
||||
* @returns { Promise<BundleStats> } Return bundleStats of the current application
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @since 9
|
||||
*/
|
||||
function getCurrentBundleStats(): Promise<BundleStats>;
|
||||
|
||||
/**
|
||||
* Get the systemsize
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { AsyncCallback<number> } callback The callback is used to return system size
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getSystemSize(callback: AsyncCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Get the systemsize
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @returns { Promise<number> } Return system size
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getSystemSize(): Promise<number>;
|
||||
|
||||
/**
|
||||
* Get the UserStorageStats
|
||||
*
|
||||
* @since 9
|
||||
* @interface StorageStats
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
export interface StorageStats {
|
||||
/**
|
||||
* The total size of device.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
total: number;
|
||||
|
||||
/**
|
||||
* The size of audio file.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
audio: number;
|
||||
|
||||
/**
|
||||
* The size of video file.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
video: number;
|
||||
|
||||
/**
|
||||
* The size of image file.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
image: number;
|
||||
|
||||
/**
|
||||
* The size of other file.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
file: number;
|
||||
|
||||
/**
|
||||
* The size of application.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
app: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UserStorageStats
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @returns { Promise<StorageStats> } Return storageStats of current user
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getUserStorageStats(): Promise<StorageStats>;
|
||||
|
||||
/**
|
||||
* Get the UserStorageStats
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { AsyncCallback<StorageStats> } callback The callback is used to return storageStats of current user
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getUserStorageStats(userId: string, callback: AsyncCallback<StorageStats>): void;
|
||||
function getUserStorageStats(callback: AsyncCallback<StorageStats>): void;
|
||||
function getUserStorageStats(userId?: string): Promise<StorageStats>;
|
||||
|
||||
/**
|
||||
* Get the UserStorageStats
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { number } userId The id of the user
|
||||
* @returns { Promise<StorageStats> } Return storageStats of the user
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600009 - User if out of range.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getUserStorageStats(userId: number): Promise<StorageStats>;
|
||||
|
||||
/**
|
||||
* Get the UserStorageStats
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { number } userId The id of the user
|
||||
* @param { AsyncCallback<StorageStats> } callback The callback is used to return storageStats of the user
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600009 - User if out of range.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getUserStorageStats(userId: number, callback: AsyncCallback<StorageStats>): void;
|
||||
|
||||
/**
|
||||
* Get the totalsize
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { AsyncCallback<number> } callback The callback is used to return the total size
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getTotalSize(callback: AsyncCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Get the totalsize
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @returns { Promise<number> } Return the total size
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getTotalSize(): Promise<number>;
|
||||
|
||||
/**
|
||||
* Get the freesize
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { AsyncCallback<number> } callback The callback is used to return the free size
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getFreeSize(callback: AsyncCallback<number>): void;
|
||||
function getFreeSize(): Promise<number>;
|
||||
|
||||
/**
|
||||
* Get the freesize
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @returns { Promise<number> } Return the free size
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getFreeSize(): Promise<number>;
|
||||
}
|
||||
|
||||
export default storageStatistics;
|
||||
|
@ -1,134 +1,410 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { AsyncCallback } from './basic';
|
||||
import type { AsyncCallback } from './@ohos.base';
|
||||
|
||||
/**
|
||||
* Provides volumemanager statistics APIs
|
||||
*
|
||||
* @since 9
|
||||
* @namespace volumeManager
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
declare namespace volumeManager {
|
||||
/**
|
||||
* Get All Volumes
|
||||
*
|
||||
* @interface Volume
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
export interface Volume {
|
||||
/**
|
||||
* Volume ID.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Universally unique identifier of volume.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
uuid: string;
|
||||
|
||||
/**
|
||||
* The ID of disk that volume belongs to.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
diskId: string;
|
||||
|
||||
/**
|
||||
* The label of the volume.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* The volume is removable or not.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
removable: boolean;
|
||||
|
||||
/**
|
||||
* The mount state of the volume.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
state: number;
|
||||
|
||||
/**
|
||||
* The mount path of the volume.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
path: string;
|
||||
}
|
||||
/**
|
||||
* Get All Volumes
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { AsyncCallback<Array<Volume>> } callback The callback is used to return the information of all volumes
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getAllVolumes(callback: AsyncCallback<Array<Volume>>): void;
|
||||
|
||||
/**
|
||||
* Get All Volumes
|
||||
*
|
||||
* @since 9
|
||||
* @systemapi
|
||||
*/
|
||||
export interface Volume {
|
||||
id: string;
|
||||
uuid: string;
|
||||
diskId: string;
|
||||
description: string;
|
||||
removable: boolean;
|
||||
state: number;
|
||||
path: string;
|
||||
}
|
||||
/**
|
||||
* Get All Volumes
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @returns { Promise<Array<Volume>> } Returns the information of all volumes
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getAllVolumes(callback: AsyncCallback<Array<Volume>>): void;
|
||||
function getAllVolumes(): Promise<Array<Volume>>;
|
||||
|
||||
|
||||
/**
|
||||
* Mount
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.MOUNT_UNMOUNT_MANAGER
|
||||
* @param { string } volumeId The id of the volume
|
||||
* @param { AsyncCallback<void> } callback Asynchronous callback interface
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600003 - Failed to mount.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function mount(volumeId: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Mount
|
||||
*
|
||||
* @permission ohos.permission.MOUNT_UNMOUNT_MANAGER
|
||||
* @param { string } volumeId The id of the volume
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600003 - Failed to mount.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function mount(volumeId: string): Promise<void>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* UnMount
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.MOUNT_UNMOUNT_MANAGER
|
||||
* @param { string } volumeId The id of the volume
|
||||
* @param { AsyncCallback<void> } callback Asynchronous callback interface
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600004 - Failed to unmount.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function unmount(volumeId: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* UnMount
|
||||
*
|
||||
* @permission ohos.permission.MOUNT_UNMOUNT_MANAGER
|
||||
* @param { string } volumeId The id of the volume
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600004 - Failed to unmount.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function unmount(volumeId: string): Promise<void>;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get the volume by uuid.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } uuid The uuid of volume
|
||||
* @param { AsyncCallback<Volume> } callback The callback is used to return the volume information.
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void;
|
||||
|
||||
/**
|
||||
* Get the volume by uuid.
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } uuid The uuid of volume
|
||||
* @returns { Promise<Volume> } Returns the volume information.
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getVolumeByUuid(uuid: string): Promise<Volume>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get the volume by id.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } volumeId The id of volume
|
||||
* @param { AsyncCallback<Volume> } callback The callback is used to return the volume information.
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void;
|
||||
|
||||
/**
|
||||
* Get the volume by id.
|
||||
*
|
||||
* @permission ohos.permission.STORAGE_MANAGER
|
||||
* @param { string } volumeId The id of volume
|
||||
* @returns { Promise<Volume> } Returns the volume information.
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function getVolumeById(volumeId: string): Promise<Volume>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the description of volume.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.MOUNT_UNMOUNT_MANAGER
|
||||
* @param { string } uuid The uuid of volume
|
||||
* @param { string } description New description of volume
|
||||
* @param { AsyncCallback<void> } callback Asynchronous callback interface
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback<boolean>): void;
|
||||
function setVolumeDescription(uuid: string, description: string): Promise<boolean>;
|
||||
function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the description of volume.
|
||||
*
|
||||
* @permission ohos.permission.MOUNT_UNMOUNT_MANAGER
|
||||
* @param { string } uuid The uuid of volume
|
||||
* @param { string } description New description of volume
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setVolumeDescription(uuid: string, description: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Format.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.MOUNT_FORMAT_MANAGER
|
||||
* @param { string } volumeId The id of the volume
|
||||
* @param { string } fsType The file system type after formatting
|
||||
* @param { AsyncCallback<void> } callback Asynchronous callback interface
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function format(volumeId: string, fsType: string, callback: AsyncCallback<boolean>): void;
|
||||
function format(volumeId: string, fsType: string): Promise<boolean>;
|
||||
function format(volumeId: string, fsType: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Format.
|
||||
*
|
||||
* @permission ohos.permission.MOUNT_FORMAT_MANAGER
|
||||
* @param { string } volumeId The id of the volume
|
||||
* @param { string } fsType The file system type after formatting
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600002 - Not supported filesystem.
|
||||
* @throws { BusinessError } 13600005 - Incorrect volume state.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function format(volumeId: string, fsType: string): Promise<void>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Partition.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @permission ohos.permission.MOUNT_FORMAT_MANAGER
|
||||
* @param { string } diskId The id of the disk
|
||||
* @param { number } type The type of partition such as private partition or public partition
|
||||
* @param { AsyncCallback<void> } callback Asynchronous callback interface
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function partition(diskId: string, type: number, callback: AsyncCallback<boolean>): void;
|
||||
function partition(diskId: string, type: number): Promise<boolean>;
|
||||
function partition(diskId: string, type: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Partition.
|
||||
*
|
||||
* @permission ohos.permission.MOUNT_FORMAT_MANAGER
|
||||
* @param { string } diskId The id of the disk
|
||||
* @param { number } type The type of partition such as private partition or public partition
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 201 - Permission verification failed.
|
||||
* @throws { BusinessError } 202 - The caller is not a system application.
|
||||
* @throws { BusinessError } 401 - The input parameter is invalid.
|
||||
* @throws { BusinessError } 13600001 - IPC error.
|
||||
* @throws { BusinessError } 13600008 - No such object.
|
||||
* @throws { BusinessError } 13900032 - Unknown error.
|
||||
* @syscap SystemCapability.FileManagement.StorageService.Volume
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function partition(diskId: string, type: number): Promise<void>;
|
||||
}
|
||||
|
||||
export default volumeManager;
|
||||
|
Loading…
Reference in New Issue
Block a user