From d3da1b58a6028393b0be3088e9bd281aec8cb377 Mon Sep 17 00:00:00 2001 From: Fouckttt Date: Sat, 2 Aug 2025 19:55:54 +0800 Subject: [PATCH] Kernel Platform Overload Correction Issue:https://gitee.com/openharmony/interface_sdk-js/issues/ICQM97 Signed-off-by: Fouckttt --- api/@ohos.file.cloudSyncManager.d.ts | 286 ++++++++++++-- api/@ohos.file.environment.d.ts | 80 +++- api/@ohos.file.fs.d.ets | 542 ++++++++++++++++----------- api/@ohos.file.securityLabel.d.ts | 102 ++++- api/@ohos.file.statvfs.d.ts | 113 +++++- 5 files changed, 861 insertions(+), 262 deletions(-) diff --git a/api/@ohos.file.cloudSyncManager.d.ts b/api/@ohos.file.cloudSyncManager.d.ts index 16db44010c..a145b5a1f5 100644 --- a/api/@ohos.file.cloudSyncManager.d.ts +++ b/api/@ohos.file.cloudSyncManager.d.ts @@ -42,8 +42,7 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise; @@ -60,8 +59,7 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function changeAppCloudSwitch( accountId: string, @@ -70,6 +68,53 @@ declare namespace cloudSyncManager { callback: AsyncCallback ): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload changeAppCloudSwitch { changeAppCloudSwitchReturnsPromise, changeAppCloudSwitchWithCallback }; + + /** + * Modify switch state of the application's cloud synchronization capability. + * + * @param { string } accountId - Current account id + * @param { string } bundleName - Name of bundle whose switchStatus is changing + * @param { boolean } status - New switch status + * @returns { Promise } - Return Promise + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function changeAppCloudSwitchReturnsPromise(accountId: string, bundleName: string, status: boolean): Promise; + + /** + * Modify switch state of the application's cloud synchronization capability. + * + * @param { string } accountId - Current account id + * @param { string } bundleName - Name of bundle whose switchStatus is changing + * @param { boolean } status - New switch status + * @param { AsyncCallback } callback - Callback function + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function changeAppCloudSwitchWithCallback( + accountId: string, + bundleName: string, + status: boolean, + callback: AsyncCallback + ): void; + /** * Notify the change of data in cloud. * @@ -82,8 +127,7 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function notifyDataChange(accountId: string, bundleName: string): Promise; @@ -99,11 +143,44 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback): void; + /** + * Notify the change of data in cloud. + * + * @param { string } accountId - Current account id + * @param { string } bundleName - Name of bundle whose switchStatus is changing + * @returns { Promise } Return Promise + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function notifyDataChangeWithBundleNameReturnsPromise(accountId: string, bundleName: string): Promise; + + /** + * Notify the change of data in cloud. + * + * @param { string } accountId - Current account id + * @param { string } bundleName - Name of bundle whose switchStatus is changing + * @param { AsyncCallback } callback - Callback function + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function notifyDataChangeWithBundleNameCallback(accountId: string, bundleName: string, callback: AsyncCallback): void; + /** * Enable the cloud file synchronization function. * @@ -117,8 +194,7 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function enableCloud(accountId: string, switches: Record): Promise; @@ -135,11 +211,52 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function enableCloud(accountId: string, switches: Record, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload enableCloud { enableCloudReturnsPromise, enableCloudWithCallback }; + + /** + * Enable the cloud file synchronization function. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { string } accountId - Current account id. + * @param { Record } switches - Indicates switches information of all applications. + * @returns { Promise } Return Promise + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function enableCloudReturnsPromise(accountId: string, switches: Record): Promise; + + /** + * Enable the cloud file synchronization function. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { string } accountId - Current account id + * @param { Record } switches - Indicates switches information of all applications. + * @param { AsyncCallback } callback - Callback function + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function enableCloudWithCallback(accountId: string, switches: Record, callback: AsyncCallback): void; + /** * Disable the cloud file synchronization function. * @@ -152,8 +269,7 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function disableCloud(accountId: string): Promise; @@ -169,11 +285,50 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function disableCloud(accountId: string, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload disableCloud { disableCloudReturnsPromise, disableCloudWithCallback }; + + /** + * Disable the cloud file synchronization function. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { string } accountId - Current account id. + * @returns { Promise } Return Promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function disableCloudReturnsPromise(accountId: string): Promise; + + /** + * Disable the cloud file synchronization function. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { string } accountId - Current account id. + * @param { AsyncCallback } callback - Callback function + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function disableCloudWithCallback(accountId: string, callback: AsyncCallback): void; + /** * Describes the clear action type. * @@ -218,8 +373,7 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function clean(accountId: string, appActions: Record): Promise; @@ -236,11 +390,52 @@ declare namespace cloudSyncManager { *
2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function clean(accountId: string, appActions: Record, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload clean { cleanReturnsPromise, cleanWithCallback }; + + /** + * Clean up cloud-related file data based on specific action. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { string } accountId - Current account id. + * @param { Record } appActions - Indicates information about cloud file need to clear in which way. + * @returns { Promise } Return Promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function cleanReturnsPromise(accountId: string, appActions: Record): Promise; + + /** + * Clean up cloud-related file data based on specific action. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { string } accountId - Current account id. + * @param { Record } appActions - Indicates information about cloud file need to clear in which way. + * @param { AsyncCallback } callback - Callback function + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function cleanWithCallback(accountId: string, appActions: Record, callback: AsyncCallback): void; + /** * Notify the change of data in cloud. * @@ -255,8 +450,7 @@ declare namespace cloudSyncManager { * @throws { BusinessError } 13600001 - IPC error. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function notifyDataChange(userId: int, extraData: ExtraData): Promise; @@ -274,11 +468,55 @@ declare namespace cloudSyncManager { * @throws { BusinessError } 13600001 - IPC error. * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager * @systemapi - * @since arkts{ '1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function notifyDataChange(userId: int, extraData: ExtraData, callback: AsyncCallback): void; + /** + * Notify the change of data in cloud. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { int } userId - The Id of the user whose cloud data changed + * @param { ExtraData } extraData - The change info from push notification + * @returns { Promise } Return Promise + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 13600001 - IPC error. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function notifyDataChangeWithExtraDataReturnsPromise(userId: int, extraData: ExtraData): Promise; + + /** + * Notify the change of data in cloud. + * + * @permission ohos.permission.CLOUDFILE_SYNC_MANAGER + * @param { int } userId - The Id of the user whose cloud data changed + * @param { ExtraData } extraData - The change info from push notification + * @param { AsyncCallback } callback - Callback function + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 13600001 - IPC error. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function notifyDataChangeWithExtraDataCallback(userId: int, extraData: ExtraData, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload notifyDataChange { notifyDataChangeWithBundleNameReturnsPromise, notifyDataChangeWithBundleNameCallback, + notifyDataChangeWithExtraDataReturnsPromise, notifyDataChangeWithExtraDataCallback }; + /** * The change info from push notification. * diff --git a/api/@ohos.file.environment.d.ts b/api/@ohos.file.environment.d.ts index cb5c78b0fd..d8332b5735 100644 --- a/api/@ohos.file.environment.d.ts +++ b/api/@ohos.file.environment.d.ts @@ -38,8 +38,7 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since arkts {'1.1':'8','1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ function getStorageDataDir(): Promise; @@ -52,11 +51,44 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since arkts {'1.1':'8','1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ function getStorageDataDir(callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getStorageDataDir { getStorageDataDirReturnsPromise, getStorageDataDirWithCallback }; + + /** + * Get the user data path. + * + * @returns { Promise } return Promise + * @throws { BusinessError } 202 - The caller is not a system application + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.Environment + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getStorageDataDirReturnsPromise(): Promise; + + /** + * Get the user data path. + * + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 202 - The caller is not a system application + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.Environment + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getStorageDataDirWithCallback(callback: AsyncCallback): void; + /** * Get the User storage path. * @@ -66,8 +98,7 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since arkts {'1.1':'8','1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ function getUserDataDir(): Promise; @@ -80,11 +111,44 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since arkts {'1.1':'8','1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ function getUserDataDir(callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getUserDataDir { getUserDataDirReturnsPromise, getUserDataDirWithCallback }; + + /** + * Get the User storage path. + * + * @returns { Promise } return Promise + * @throws { BusinessError } 202 - The caller is not a system application + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.Environment + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getUserDataDirReturnsPromise(): Promise; + + /** + * Get the User storage path. + * + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 202 - The caller is not a system application + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.Environment + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getUserDataDirWithCallback(callback: AsyncCallback): void; + /** * Get the public download directory. * diff --git a/api/@ohos.file.fs.d.ets b/api/@ohos.file.fs.d.ets index 735f45cac8..9397825900 100644 --- a/api/@ohos.file.fs.d.ets +++ b/api/@ohos.file.fs.d.ets @@ -160,11 +160,9 @@ declare namespace fileIo { * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function access(path: string, mode?: AccessModeType): Promise; +function accessReturnsPromise(path: string, mode?: AccessModeType): Promise; /** * Access file. @@ -184,11 +182,9 @@ function access(path: string, mode?: AccessModeType): Promise; * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function access(path: string, callback: AsyncCallback): void; +function accessWithCallback(path: string, callback: AsyncCallback): void; /** * Access file. @@ -198,7 +194,7 @@ function access(path: string, callback: AsyncCallback): void; * @param { AccessFlagType } flag - accessibility flag. * @returns { Promise } Returns the file is accessible or not in promise mode. * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. + * 2.Incorrect parameter types. * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900012 - Permission denied @@ -211,7 +207,12 @@ function access(path: string, callback: AsyncCallback): void; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise; +function accessWithFlagReturnsPromise(path: string, mode: AccessModeType, flag: AccessFlagType): Promise; + +/** + * @since 20 + */ +overload access { accessReturnsPromise, accessWithCallback, accessWithFlagReturnsPromise }; /** * @@ -233,11 +234,9 @@ function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promi * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function accessSync(path: string, mode?: AccessModeType): boolean; +function accessSyncWithPathMode(path: string, mode?: AccessModeType): boolean; /** * Access file with sync interface. @@ -247,7 +246,7 @@ function accessSync(path: string, mode?: AccessModeType): boolean; * @param { AccessFlagType } flag - accessibility flag. * @returns { boolean } Returns the file is accessible or not. * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. + * 2.Incorrect parameter types. * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900012 - Permission denied @@ -260,7 +259,12 @@ function accessSync(path: string, mode?: AccessModeType): boolean; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean; +function accessSyncWithPathModeFlag(path: string, mode: AccessModeType, flag: AccessFlagType): boolean; + +/** + * @since 20 + */ +overload accessSync { accessSyncWithPathMode, accessSyncWithPathModeFlag }; /** * Close file or fd. @@ -274,11 +278,9 @@ function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): b * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function close(file: int | File): Promise; +function closeReturnsPromise(file: int | File): Promise; /** * Close file or fd. @@ -292,11 +294,14 @@ function close(file: int | File): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function close(file: int | File, callback: AsyncCallback): void; +function closeWithCallback(file: int | File, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload close { closeReturnsPromise, closeWithCallback }; /** * Close file or fd with sync interface. @@ -309,8 +314,6 @@ function close(file: int | File, callback: AsyncCallback): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ function closeSync(file: int | File): void; @@ -323,7 +326,7 @@ function closeSync(file: int | File): void; * @param { CopyOptions } [options] - options. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. + * 2.Incorrect parameter types. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -352,7 +355,7 @@ function closeSync(file: int | File): void; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise; +function copyReturnsPromise(srcUri: string, destUri: string, options?: CopyOptions): Promise; /** * Copy file or directory. @@ -361,7 +364,7 @@ function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise } callback - Return the callback function. * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. + * 2.Incorrect parameter types. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -389,7 +392,7 @@ function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise): void; +function copyWithCallback(srcUri: string, destUri: string, callback: AsyncCallback): void; /** * Copy file or directory. @@ -399,7 +402,7 @@ function copy(srcUri: string, destUri: string, callback: AsyncCallback): v * @param { CopyOptions } options - options. * @param { AsyncCallback } callback - Return the callback function. * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. + * 2.Incorrect parameter types. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -427,7 +430,13 @@ function copy(srcUri: string, destUri: string, callback: AsyncCallback): v * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void; +function copyWithOptionsCallback(srcUri: string, destUri: string, + options: CopyOptions, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload copy { copyReturnsPromise, copyWithCallback, copyWithOptionsCallback }; /** * Copy directory. @@ -457,7 +466,7 @@ function copy(srcUri: string, destUri: string, options: CopyOptions, callback: A * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function copyDir(src: string, dest: string, mode?: int): Promise; +function copyDirReturnsPromise(src: string, dest: string, mode?: int): Promise; /** * Copy directory. @@ -485,7 +494,7 @@ function copyDir(src: string, dest: string, mode?: int): Promise; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function copyDir(src: string, dest: string, callback: AsyncCallback): void; +function copyDirWithCallback(src: string, dest: string, callback: AsyncCallback): void; /** * Copy directory. @@ -497,7 +506,8 @@ function copyDir(src: string, dest: string, callback: AsyncCallback): void * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function copyDir(src: string, dest: string, callback: AsyncCallback>): void; +function copyDirWithCallbackOfArrayOfConflictFiles(src: string, dest: string, + callback: AsyncCallback>): void; /** * Copy directory. @@ -526,7 +536,7 @@ function copyDir(src: string, dest: string, callback: AsyncCallback): void; +function copyDirWithModeCallback(src: string, dest: string, mode: int, callback: AsyncCallback): void; /** * Copy directory. @@ -539,7 +549,15 @@ function copyDir(src: string, dest: string, mode: int, callback: AsyncCallback>): void; +function copyDirWithModeCallbackOfArrayOfConflictFiles(src: string, dest: string, + mode: int, callback: AsyncCallback>): void; + +/** + * @since 20 + */ +overload copyDir { copyDirReturnsPromise, copyDirWithCallback, + copyDirWithCallbackOfArrayOfConflictFiles, copyDirWithModeCallback, + copyDirWithModeCallbackOfArrayOfConflictFiles}; /** * Copy directory with sync interface. @@ -597,11 +615,9 @@ function copyDirSync(src: string, dest: string, mode?: int): void; * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function copyFile(src: string | int, dest: string | int, mode?: int): Promise; +function copyFileReturnsPromise(src: string | int, dest: string | int, mode?: int): Promise; /** * Copy file. @@ -627,18 +643,16 @@ function copyFile(src: string | int, dest: string | int, mode?: int): Promise): void; +function copyFileWithCallback(src: string | int, dest: string | int, callback: AsyncCallback): void; /** * Copy file. * * @param { string | int } src - src. * @param { string | int } dest - dest. - * @param { int } [mode = 0] - mode. + * @param { int } mode = 0 - mode. * @param { AsyncCallback } callback - Return the callback function. * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -658,17 +672,20 @@ function copyFile(src: string | int, dest: string | int, callback: AsyncCallback * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function copyFile( +function copyFileWithModeCallback( src: string | int, dest: string | int, mode: int, callback: AsyncCallback ): void; +/** + * @since 20 + */ +overload copyFile { copyFileReturnsPromise, copyFileWithCallback, copyFileWithModeCallback }; + /** * Copy file with sync interface. * @@ -736,7 +753,7 @@ function copyFileSync(src: string | int, dest: string | int, mode?: int): void; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function createStream(path: string, mode: string): Promise; +function createStreamReturnsPromise(path: string, mode: string): Promise; /** * Create class Stream. @@ -773,7 +790,12 @@ function createStream(path: string, mode: string): Promise; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function createStream(path: string, mode: string, callback: AsyncCallback): void; +function createStreamWithCallback(path: string, mode: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload createStream { createStreamReturnsPromise, createStreamWithCallback }; /** * Create class Stream with sync interface. @@ -850,14 +872,15 @@ function createStreamSync(path: string, mode: string): Stream; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function createRandomAccessFile(file: string | File, mode?: int, +function createRandomAccessFileReturnsPromise(file: string | File, mode?: int, options?: RandomAccessFileOptions): Promise; /** * Create class RandomAccessFile. * * @param { string | File } file - file path, object. - * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. + * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object + * which has been created. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -887,14 +910,15 @@ function createRandomAccessFile(file: string | File, mode?: int, * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function createRandomAccessFile(file: string | File, callback: AsyncCallback): void; +function createRandomAccessFileWithCallback(file: string | File, callback: AsyncCallback): void; /** * Create class RandomAccessFile. * * @param { string | File } file - file path, object. - * @param { int } [mode = OpenMode.READ_ONLY] - mode. - * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. + * @param { int } mode = OpenMode.READ_ONLY - mode. + * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object + * which has been created. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -924,7 +948,14 @@ function createRandomAccessFile(file: string | File, callback: AsyncCallback): void; +function createRandomAccessFileWithModeCallback(file: string | File, mode: int, + callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload createRandomAccessFile { createRandomAccessFileReturnsPromise, createRandomAccessFileWithCallback, + createRandomAccessFileWithModeCallback }; /** * Create class RandomAccessFile with sync interface. @@ -1077,10 +1108,9 @@ function dup(fd: int): File; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function fdatasync(fd: int): Promise; +function fdatasyncReturnsPromise(fd: int): Promise; /** * Synchronize file metadata. @@ -1095,10 +1125,14 @@ function fdatasync(fd: int): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function fdatasync(fd: int, callback: AsyncCallback): void; +function fdatasyncWithCallback(fd: int, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload fdatasync { fdatasyncReturnsPromise, fdatasyncWithCallback }; /** * Synchronize file metadata with sync interface. @@ -1153,7 +1187,7 @@ function fdatasyncSync(fd: int): void; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function fdopenStream(fd: int, mode: string): Promise; +function fdopenStreamReturnsPromise(fd: int, mode: string): Promise; /** * Create class Stream by using fd. @@ -1191,7 +1225,12 @@ function fdopenStream(fd: int, mode: string): Promise; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function fdopenStream(fd: int, mode: string, callback: AsyncCallback): void; +function fdopenStreamWithCallback(fd: int, mode: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload fdopenStream { fdopenStreamReturnsPromise, fdopenStreamWithCallback }; /** * Create class Stream by using fd with sync interface. @@ -1244,10 +1283,9 @@ function fdopenStreamSync(fd: int, mode: string): Stream; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function fsync(fd: int): Promise; +function fsyncReturnsPromise(fd: int): Promise; /** * Synchronize file. @@ -1262,10 +1300,14 @@ function fsync(fd: int): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function fsync(fd: int, callback: AsyncCallback): void; +function fsyncWithCallback(fd: int, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload fsync { fsyncReturnsPromise, fsyncWithCallback }; /** * Synchronize file with sync interface. @@ -1289,19 +1331,17 @@ function fsyncSync(fd: int): void; * * @param { string } path - path. * @param { ListFileOptions } [options] - options. - * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. - * If present, Include the subdirectory structure. + * @returns { Promise } Returns an Array containing the name of files or directories + * that meet the filter criteria. If present, Include the subdirectory structure. * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function listFile( +function listFileReturnsPromise( path: string, options?: ListFileOptions ): Promise; @@ -1310,43 +1350,46 @@ function listFile( * List file. * * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name + * of files or directories that meet the filter criteria in promise mode. + * If present, Include the subdirectory structure. * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function listFile(path: string, callback: AsyncCallback): void; +function listFileWithCallback(path: string, callback: AsyncCallback): void; /** * List file. * * @param { string } path - path. - * @param { ListFileOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @param { ListFileOptions } options - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name + * of files or directories that meet the filter criteria in promise mode. + * If present, Include the subdirectory structure. * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function listFile( +function listFileWithOptionsCallback( path: string, options: ListFileOptions, callback: AsyncCallback ): void; +/** + * @since 20 + */ +overload listFile { listFileReturnsPromise, listFileWithCallback, listFileWithOptionsCallback }; + /** * List file with sync interface. * @@ -1404,7 +1447,7 @@ function lseek(fd: int, offset: long, whence?: WhenceType): long; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function lstat(path: string): Promise; +function lstatReturnsPromise(path: string): Promise; /** * Stat link file. @@ -1424,7 +1467,12 @@ function lstat(path: string): Promise; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function lstat(path: string, callback: AsyncCallback): void; +function lstatWithCallback(path: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload lstat { lstatReturnsPromise, lstatWithCallback }; /** * Stat link file with sync interface. @@ -1467,11 +1515,9 @@ function lstatSync(path: string): Stat; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function mkdir(path: string): Promise; +function mkdirReturnsPromise(path: string): Promise; /** * Make dir. @@ -1495,11 +1541,9 @@ function mkdir(path: string): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function mkdir(path: string, recursion: boolean): Promise; +function mkdirWithRecursionReturnsPromise(path: string, recursion: boolean): Promise; /** * Make dir. @@ -1522,11 +1566,9 @@ function mkdir(path: string, recursion: boolean): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function mkdir(path: string, callback: AsyncCallback): void; +function mkdirWithCallback(path: string, callback: AsyncCallback): void; /** * Make dir. @@ -1550,11 +1592,15 @@ function mkdir(path: string, callback: AsyncCallback): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void; +function mkdirWithRecursionCallback(path: string, recursion: boolean, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload mkdir { mkdirReturnsPromise, mkdirWithRecursionReturnsPromise, + mkdirWithCallback, mkdirWithRecursionCallback }; /** * Make dir with sync interface. @@ -1576,11 +1622,9 @@ function mkdir(path: string, recursion: boolean, callback: AsyncCallback): * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function mkdirSync(path: string): void; +function mkdirSyncWithPath(path: string): void; /** * Make dir with sync interface. @@ -1603,11 +1647,14 @@ function mkdirSync(path: string): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function mkdirSync(path: string, recursion: boolean): void; +function mkdirSyncWithPathRecursion(path: string, recursion: boolean): void; + +/** + * @since 20 + */ +overload mkdirSync { mkdirSyncWithPath, mkdirSyncWithPathRecursion }; /** * Make temp dir. @@ -1630,10 +1677,9 @@ function mkdirSync(path: string, recursion: boolean): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function mkdtemp(prefix: string): Promise; +function mkdtempReturnsPromise(prefix: string): Promise; /** * Make temp dir. @@ -1656,10 +1702,14 @@ function mkdtemp(prefix: string): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function mkdtemp(prefix: string, callback: AsyncCallback): void; +function mkdtempWithCallback(prefix: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload mkdtemp { mkdtempReturnsPromise, mkdtempWithCallback }; /** * Make temp dir with sync interface. @@ -1716,7 +1766,7 @@ function mkdtempSync(prefix: string): string; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function moveDir(src: string, dest: string, mode?: int): Promise; +function moveDirReturnsPromise(src: string, dest: string, mode?: int): Promise; /** * Move directory. @@ -1745,7 +1795,7 @@ function moveDir(src: string, dest: string, mode?: int): Promise; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function moveDir(src: string, dest: string, callback: AsyncCallback): void; +function moveDirWithCallback(src: string, dest: string, callback: AsyncCallback): void; /** * Move directory. @@ -1757,7 +1807,8 @@ function moveDir(src: string, dest: string, callback: AsyncCallback): void * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function moveDir(src: string, dest: string, callback: AsyncCallback>): void; +function moveDirWithCallbackOfArrayOfConflictFiles(src: string, dest: string, + callback: AsyncCallback>): void; /** * Move directory. @@ -1787,7 +1838,7 @@ function moveDir(src: string, dest: string, callback: AsyncCallback): void; +function moveDirWithModeCallback(src: string, dest: string, mode: int, callback: AsyncCallback): void; /** * Move directory. @@ -1800,7 +1851,15 @@ function moveDir(src: string, dest: string, mode: int, callback: AsyncCallback>): void; +function moveDirWithModeCallbackOfArrayOfConflictFiles(src: string, dest: string, + mode: int, callback: AsyncCallback>): void; + +/** + * @since 20 + */ +overload moveDir { moveDirReturnsPromise, moveDirWithCallback, + moveDirWithCallbackOfArrayOfConflictFiles, moveDirWithModeCallback, + moveDirWithModeCallbackOfArrayOfConflictFiles }; /** * Move directory with sync interface. @@ -1859,10 +1918,9 @@ function moveDirSync(src: string, dest: string, mode?: int): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function moveFile(src: string, dest: string, mode?: int): Promise; +function moveFileReturnsPromise(src: string, dest: string, mode?: int): Promise; /** * Move file. @@ -1890,17 +1948,16 @@ function moveFile(src: string, dest: string, mode?: int): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function moveFile(src: string, dest: string, callback: AsyncCallback): void; +function moveFileWithCallback(src: string, dest: string, callback: AsyncCallback): void; /** * Move file. * * @param { string } src - source file path. * @param { string } dest - destination file path. - * @param { int } [mode = 0] - move mode when duplicate file name exists. + * @param { int } mode = 0 - move mode when duplicate file name exists. * @param { AsyncCallback } callback - Return the callback function. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory @@ -1922,10 +1979,14 @@ function moveFile(src: string, dest: string, callback: AsyncCallback): voi * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 */ -function moveFile(src: string, dest: string, mode: int, callback: AsyncCallback): void; +function moveFileWithModeCallback(src: string, dest: string, mode: int, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload moveFile { moveFileReturnsPromise, moveFileWithCallback, moveFileWithModeCallback }; /** * Move file with sync interface. @@ -1992,17 +2053,16 @@ function moveFileSync(src: string, dest: string, mode?: int): void; * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function open(path: string, mode?: int): Promise; +function openReturnsPromise(path: string, mode?: int): Promise; /** * Open file. * * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the File object + * to record the file descriptor. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -2030,18 +2090,17 @@ function open(path: string, mode?: int): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function open(path: string, callback: AsyncCallback): void; +function openWithCallback(path: string, callback: AsyncCallback): void; /** * Open file. * * @param { string } path - path. - * @param { int } [mode = OpenMode.READ_ONLY] - mode. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @param { int } mode = OpenMode.READ_ONLY - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object + * to record the file descriptor. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900004 - Interrupted system call @@ -2069,11 +2128,14 @@ function open(path: string, callback: AsyncCallback): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function open(path: string, mode: int, callback: AsyncCallback): void; +function openWithModeCallback(path: string, mode: int, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload open { openReturnsPromise, openWithCallback, openWithModeCallback }; /** * Open file with sync interface. @@ -2133,11 +2195,9 @@ function openSync(path: string, mode?: int): File; * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function read( +function readReturnsPromise( fd: int, buffer: ArrayBuffer, options?: ReadOptions @@ -2159,18 +2219,16 @@ function read( * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function read(fd: int, buffer: ArrayBuffer, callback: AsyncCallback): void; +function readWithCallback(fd: int, buffer: ArrayBuffer, callback: AsyncCallback): void; /** * Read file. * * @param { int } fd - file descriptor. * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. + * @param { ReadOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -2182,17 +2240,20 @@ function read(fd: int, buffer: ArrayBuffer, callback: AsyncCallback): void * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function read( +function readWithOptionsCallback( fd: int, buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback ): void; +/** + * @since 20 + */ +overload read { readReturnsPromise, readWithCallback, readWithOptionsCallback }; + /** * Read file with sync interface. * @@ -2243,7 +2304,7 @@ function readSync( * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function readLines(filePath: string, options?: Options): Promise; +function readLinesReturnsPromise(filePath: string, options?: Options): Promise; /** * Read content line by line. @@ -2265,7 +2326,7 @@ function readLines(filePath: string, options?: Options): Promise * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function readLines(filePath: string, callback: AsyncCallback): void; +function readLinesWithCallback(filePath: string, callback: AsyncCallback): void; /** * Read content line by line. @@ -2288,7 +2349,13 @@ function readLines(filePath: string, callback: AsyncCallback): v * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function readLines(filePath: string, options: Options, callback: AsyncCallback): void; +function readLinesWithOptionsCallback(filePath: string, options: Options, + callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload readLines { readLinesReturnsPromise, readLinesWithCallback, readLinesWithOptionsCallback }; /** * Read content line by line with sync interface. @@ -2335,11 +2402,9 @@ function readLinesSync(filePath: string, options?: Options): ReaderIterator; * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function readText( +function readTextReturnsPromise( filePath: string, options?: ReadTextOptions ): Promise; @@ -2363,17 +2428,15 @@ function readText( * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function readText(filePath: string, callback: AsyncCallback): void; +function readTextWithCallback(filePath: string, callback: AsyncCallback): void; /** * Read text. * * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. + * @param { ReadTextOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call @@ -2389,16 +2452,19 @@ function readText(filePath: string, callback: AsyncCallback): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function readText( +function readTextWithOptionsCallback( filePath: string, options: ReadTextOptions, callback: AsyncCallback ): void; +/** + * @since 20 + */ +overload readText { readTextReturnsPromise, readTextWithCallback, readTextWithOptionsCallback }; + /** * Read text with sync interface. * @@ -2455,11 +2521,9 @@ function readTextSync( * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function rename(oldPath: string, newPath: string): Promise; +function renameReturnsPromise(oldPath: string, newPath: string): Promise; /** * Rename file. @@ -2487,11 +2551,14 @@ function rename(oldPath: string, newPath: string): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; +function renameWithCallback(oldPath: string, newPath: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload rename { renameReturnsPromise, renameWithCallback }; /** * Rename file with sync interface. @@ -2542,11 +2609,9 @@ function renameSync(oldPath: string, newPath: string): void; * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function rmdir(path: string): Promise; +function rmdirReturnsPromise(path: string): Promise; /** * Delete dir. @@ -2566,11 +2631,14 @@ function rmdir(path: string): Promise; * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function rmdir(path: string, callback: AsyncCallback): void; +function rmdirWithCallback(path: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload rmdir { rmdirReturnsPromise, rmdirWithCallback }; /** * Delete dir with sync interface. @@ -2614,11 +2682,9 @@ function rmdirSync(path: string): void; * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function stat(file: string | int): Promise; +function statReturnsPromise(file: string | int): Promise; /** * Get file information. @@ -2639,11 +2705,14 @@ function stat(file: string | int): Promise; * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function stat(file: string | int, callback: AsyncCallback): void; +function statWithCallback(file: string | int, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload stat { statReturnsPromise, statWithCallback }; /** * Get file information with sync interface. @@ -2693,7 +2762,7 @@ function statSync(file: string | int): Stat; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function symlink(target: string, srcPath: string): Promise; +function symlinkReturnsPromise(target: string, srcPath: string): Promise; /** * Link file. @@ -2718,7 +2787,12 @@ function symlink(target: string, srcPath: string): Promise; * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ -function symlink(target: string, srcPath: string, callback: AsyncCallback): void; +function symlinkWithCallback(target: string, srcPath: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload symlink { symlinkReturnsPromise, symlinkWithCallback }; /** * Link file with sync interface. @@ -2767,11 +2841,9 @@ function symlinkSync(target: string, srcPath: string): void; * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function truncate(file: string | int, len?: long): Promise; +function truncateReturnsPromise(file: string | int, len?: long): Promise; /** * Truncate file. @@ -2795,17 +2867,15 @@ function truncate(file: string | int, len?: long): Promise; * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function truncate(file: string | int, callback: AsyncCallback): void; +function truncateWithCallback(file: string | int, callback: AsyncCallback): void; /** * Truncate file. * * @param { string | int } file - path or file descriptor. - * @param { long } [len = 0] - len. + * @param { long } len = 0 - len. * @param { AsyncCallback } callback - Return the callback function. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900002 - No such file or directory @@ -2824,11 +2894,14 @@ function truncate(file: string | int, callback: AsyncCallback): void; * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function truncate(file: string | int, len: long, callback: AsyncCallback): void; +function truncateWithLenCallback(file: string | int, len: long, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload truncate { truncateReturnsPromise, truncateWithCallback, truncateWithLenCallback }; /** * Truncate file with sync interface. @@ -2879,11 +2952,9 @@ function truncateSync(file: string | int, len?: long): void; * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function unlink(path: string): Promise; +function unlinkReturnsPromise(path: string): Promise; /** * Delete file. @@ -2906,11 +2977,14 @@ function unlink(path: string): Promise; * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function unlink(path: string, callback: AsyncCallback): void; +function unlinkWithCallback(path: string, callback: AsyncCallback): void; + +/** + * @since 20 + */ +overload unlink { unlinkReturnsPromise, unlinkWithCallback }; /** * Delete file with sync interface. @@ -2975,11 +3049,9 @@ function utimes(path: string, mtime: double): void; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function write( +function writeReturnsPromise( fd: int, buffer: ArrayBuffer | string, options?: WriteOptions @@ -3004,18 +3076,16 @@ function write( * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice * @since 20 */ -function write(fd: int, buffer: ArrayBuffer | string, callback: AsyncCallback): void; +function writeWithCallback(fd: int, buffer: ArrayBuffer | string, callback: AsyncCallback): void; /** * Write file. * * @param { int } fd - file descriptor. * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. + * @param { WriteOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call @@ -3030,17 +3100,20 @@ function write(fd: int, buffer: ArrayBuffer | string, callback: AsyncCallback ): void; +/** + * @since 20 + */ +overload write { writeReturnsPromise, writeWithCallback, writeWithOptionsCallback }; + /** * Write file with sync interface. * @@ -3345,7 +3418,7 @@ interface File { /** * Lock file with blocking method. * - * @param { boolean } exclusive - whether lock is exclusive. + * @param { boolean } [exclusive] - whether lock is exclusive. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900008 - Bad file descriptor @@ -3356,7 +3429,7 @@ interface File { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - lock(exclusive?: boolean): Promise; + lockReturnsPromise(exclusive?: boolean): Promise; /** * Lock file with blocking method. @@ -3371,7 +3444,7 @@ interface File { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - lock(callback: AsyncCallback): void; + lockWithCallback(callback: AsyncCallback): void; /** * Lock file with blocking method. @@ -3387,7 +3460,12 @@ interface File { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - lock(exclusive: boolean, callback: AsyncCallback): void; + lockWithExclusiveCallback(exclusive: boolean, callback: AsyncCallback): void; + + /** + * @since 20 + */ + overload lock { lockReturnsPromise, lockWithCallback, lockWithExclusiveCallback }; /** * Try to lock file with returning results immediately. @@ -3497,7 +3575,7 @@ interface RandomAccessFile { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - write( + writeReturnsPromise( buffer: ArrayBuffer | string, options?: WriteOptions ): Promise; @@ -3522,13 +3600,13 @@ interface RandomAccessFile { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + writeWithCallback(buffer: ArrayBuffer | string, callback: AsyncCallback): void; /** * Write randomAccessFile. * * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. + * @param { WriteOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call @@ -3545,12 +3623,17 @@ interface RandomAccessFile { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - write( + writeWithOptionsCallback( buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback ): void; + /** + * @since 20 + */ + overload write { writeReturnsPromise, writeWithCallback, writeWithOptionsCallback }; + /** * Write randomAccessFile with sync interface. * @@ -3596,7 +3679,7 @@ interface RandomAccessFile { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - read( + readReturnsPromise( buffer: ArrayBuffer, options?: ReadOptions ): Promise; @@ -3618,13 +3701,13 @@ interface RandomAccessFile { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - read(buffer: ArrayBuffer, callback: AsyncCallback): void; + readWithCallback(buffer: ArrayBuffer, callback: AsyncCallback): void; /** * Read randomAccessFile. * * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. + * @param { ReadOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -3638,12 +3721,17 @@ interface RandomAccessFile { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - read( + readWithOptionsCallback( buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback ): void; + /** + * @since 20 + */ + overload read { readReturnsPromise, readWithCallback, readWithOptionsCallback }; + /** * Read randomAccessFile with sync interface. * @@ -4179,7 +4267,7 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - close(): Promise; + closeReturnsPromise(): Promise; /** * Close stream. @@ -4194,7 +4282,12 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - close(callback: AsyncCallback): void; + closeWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + */ + overload close { closeReturnsPromise, closeWithCallback }; /** * Close stream with sync interface. @@ -4229,7 +4322,7 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - flush(): Promise; + flushReturnsPromise(): Promise; /** * Flush stream. @@ -4250,7 +4343,12 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - flush(callback: AsyncCallback): void; + flushWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + */ + overload flush { flushReturnsPromise, flushWithCallback }; /** * Flush stream with sync interface. @@ -4293,7 +4391,7 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - write( + writeReturnsPromise( buffer: ArrayBuffer | string, options?: WriteOptions ): Promise; @@ -4318,13 +4416,13 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + writeWithCallback(buffer: ArrayBuffer | string, callback: AsyncCallback): void; /** * Write stream. * * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. + * @param { WriteOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call @@ -4341,12 +4439,17 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - write( + writeWithOptionsCallback( buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback ): void; + /** + * @since 20 + */ + overload write { writeReturnsPromise, writeWithCallback, writeWithOptionsCallback }; + /** * Write stream with sync interface. * @@ -4392,7 +4495,7 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - read( + readReturnsPromise( buffer: ArrayBuffer, options?: ReadOptions ): Promise; @@ -4414,13 +4517,13 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - read(buffer: ArrayBuffer, callback: AsyncCallback): void; + readWithCallback(buffer: ArrayBuffer, callback: AsyncCallback): void; /** * Read stream. * * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. + * @param { ReadOptions } options - options. * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -4434,12 +4537,17 @@ interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ - read( + readWithOptionsCallback( buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback ): void; + /** + * @since 20 + */ + overload read { readReturnsPromise, readWithCallback, readWithOptionsCallback }; + /** * Read stream with sync interface. * diff --git a/api/@ohos.file.securityLabel.d.ts b/api/@ohos.file.securityLabel.d.ts index f675714f29..4a718cce37 100644 --- a/api/@ohos.file.securityLabel.d.ts +++ b/api/@ohos.file.securityLabel.d.ts @@ -54,8 +54,7 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function setSecurityLabel(path: string, type: DataLevel): Promise; @@ -74,11 +73,56 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload setSecurityLabel { setSecurityLabelReturnsPromise, setSecurityLabelWithCallback }; + + /** + * Set the SecurityLabel. + * + * @param { string } path - path + * @param { DataLevel } type - type + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function setSecurityLabelReturnsPromise(path: string, type: DataLevel): Promise; + + /** + * Set the SecurityLabel. + * + * @param { string } path - path + * @param { DataLevel } type - type + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function setSecurityLabelWithCallback(path: string, type: DataLevel, callback: AsyncCallback): void; + /** * Set the SecurityLabel with sync interface. * @@ -112,8 +156,7 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getSecurityLabel(path: string): Promise; @@ -131,11 +174,54 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getSecurityLabel(path: string, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getSecurityLabel { getSecurityLabelReturnsPromise, getSecurityLabelWithCallback }; + + /** + * Get the SecurityLabel. + * + * @param { string } path - path + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function getSecurityLabelReturnsPromise(path: string): Promise; + + /** + * Get the SecurityLabel. + * + * @param { string } path - path + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function getSecurityLabelWithCallback(path: string, callback: AsyncCallback): void; + /** * Get the SecurityLabel with sync interface. * diff --git a/api/@ohos.file.statvfs.d.ts b/api/@ohos.file.statvfs.d.ts index b844c7dd5f..7c7223d03a 100644 --- a/api/@ohos.file.statvfs.d.ts +++ b/api/@ohos.file.statvfs.d.ts @@ -79,7 +79,6 @@ declare namespace statfs { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 20 - * @arkts 1.1&1.2 */ function getFreeSize(path: string): Promise; @@ -123,12 +122,64 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform * @since 20 - * @arkts 1.1&1.2 */ function getFreeSize(path: string, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getFreeSize { getFreeSizeReturnsPromise, getFreeSizeWithCallback }; + + /** + * Get the number of free bytes on the specified path. + * + * @param { string } path - path + * @returns { Promise } return Promise + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function getFreeSizeReturnsPromise(path: string): Promise; + + /** + * Get the number of free bytes on the specified path. + * + * @param { string } path - path + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function getFreeSizeWithCallback(path: string, callback: AsyncCallback): void; + /** * Get the number of free bytes on the specified path with sync interface. * @@ -217,7 +268,6 @@ declare namespace statfs { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 20 - * @arkts 1.1&1.2 */ function getTotalSize(path: string): Promise; @@ -263,10 +313,63 @@ declare namespace statfs { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 20 - * @arkts 1.1&1.2 */ function getTotalSize(path: string, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getTotalSize { getTotalSizeReturnsPromise, getTotalSizeWithCallback }; + + /** + * Get the number of total bytes on the specified path. + * + * @param { string } path - path + * @returns { Promise } return Promise + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function getTotalSizeReturnsPromise(path: string): Promise; + + /** + * Get the number of total bytes on the specified path. + * + * @param { string } path - path + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + function getTotalSizeWithCallback(path: string, callback: AsyncCallback): void; + /** * Get the number of total bytes on the specified path with sync interface. * -- Gitee