diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md index 7c2974d0c8fc4eef7a911523fdeb96c596304c94..d8ab6bcb1cbcaf022e527078629262c17e8a041d 100644 --- a/en/application-dev/reference/apis/js-apis-appAccount.md +++ b/en/application-dev/reference/apis/js-apis-appAccount.md @@ -198,18 +198,23 @@ Creates an app account implicitly based on the specified account owner. This API **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; - function onResultCallback(code, result) { console.log("resultCode: " + code); console.log("result: " + JSON.stringify(result)); } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { console.log("startAbility err: " + JSON.stringify(err)); - }); + }) } try { @@ -252,18 +257,23 @@ Creates an app account implicitly based on the specified account owner and optio **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; - function onResultCallback(code, result) { console.log("resultCode: " + code); console.log("result: " + JSON.stringify(result)); } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { console.log("startAbility err: " + JSON.stringify(err)); - }); + }) } let options = { @@ -1090,7 +1100,8 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void Obtains information about all accessible app accounts. This API uses an asynchronous callback to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Parameters** @@ -1127,7 +1138,8 @@ getAllAccounts(): Promise<Array<AppAccountInfo>> Obtains information about all accessible app accounts. This API uses a promise to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Return value** @@ -1162,7 +1174,8 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses an asynchronous callback to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Parameters** @@ -1202,7 +1215,8 @@ getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>> Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses a promise to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Parameters** @@ -1303,7 +1317,7 @@ Unsubscribes from account information changes. **Example** ```js - function changeOnCallback(data) { + function changeOnCallback(data){ console.log("receive change data:" + JSON.stringify(data)); } try{ @@ -1350,7 +1364,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; + function onResultCallback(code, authResult) { console.log("resultCode: " + code); @@ -1358,10 +1372,17 @@ Authenticates an app account. This API uses an asynchronous callback to return t } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { - console.log("startAbility err: " + JSON.stringify(err)); - }); + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { + console.log("startAbility err: " + JSON.stringify(err)); + }) } try { @@ -1406,7 +1427,7 @@ Authenticates an app account with customized options. This API uses an asynchron **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; + function onResultCallback(code, authResult) { console.log("resultCode: " + code); @@ -1414,10 +1435,17 @@ Authenticates an app account with customized options. This API uses an asynchron } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { - console.log("startAbility err: " + JSON.stringify(err)); - }); + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { + console.log("startAbility err: " + JSON.stringify(err)); + }) } let options = { @@ -2710,7 +2738,7 @@ Adds an app account. This API uses an asynchronous callback to return the result | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | -------------------- | -| name | string | Yes | Name of the target app account. | +| name | string | Yes | Name of the app account to add. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| **Example** @@ -2755,8 +2783,7 @@ addAccount(name: string, extraInfo?: string): Promise<void> Adds an app account name and additional information. This API uses an asynchronous callback to return the result. This API uses a promise to return the result. -> **NOTE** -> +> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2). **System capability**: SystemCapability.Account.AppAccount @@ -2808,7 +2835,7 @@ Adds an app account implicitly based on the specified owner. This API uses an as **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; + function onResultCallback(code, result) { console.log("resultCode: " + code); @@ -2816,10 +2843,17 @@ Adds an app account implicitly based on the specified owner. This API uses an as } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err)=>{ + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { console.log("startAbility err: " + JSON.stringify(err)); - }); + }) } appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { @@ -2844,7 +2878,7 @@ Deletes an app account. This API uses an asynchronous callback to return the res | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------- | -| name | string | Yes | Name of the target app account. | +| name | string | Yes | Name of the app account to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| **Example** @@ -2871,7 +2905,7 @@ Deletes an app account. This API uses a promise to return the result. | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ----------- | -| name | string | Yes | Name of the target app account.| +| name | string | Yes | Name of the app account to delete.| **Return value** @@ -3756,18 +3790,23 @@ Authenticates an app account with customized options. This API uses an asynchron **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; - function onResultCallback(code, result) { console.log("resultCode: " + code); console.log("result: " + JSON.stringify(result)); } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err)=>{ - console.log("startAbility err: " + JSON.stringify(err)); - }); + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { + console.log("startAbility err: " + JSON.stringify(err)); + }) } appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { @@ -4526,10 +4565,13 @@ Enumerates the constants. | KEY_REQUIRED_LABELS9+ | "requiredLabels" | Required labels. | | KEY_BOOLEAN_RESULT9+ | "booleanResult" | Return value of the Boolean type. | -## ResultCode8+ +## ResultCode(deprecated) Enumerates the result codes. +> **NOTE** +> This enum is supported since API version 8 and deprecated since API version 9. From API version 9, error codes are used. For details about the error codes, see [App Account Error Codes](../errorcodes/errorcode-account.md). + **System capability**: SystemCapability.Account.AppAccount | Name | Value | Description | @@ -4765,7 +4807,7 @@ Creates an app account implicitly based on the specified account owner. This API | Name | Type | Mandatory | Description | | ---------------- | --------------------- | ---- | --------------- | -| options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating the account. | +| options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating an account. | | callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the result.| ### addAccountImplicitly(deprecated) diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md index 333b0621fd078620e501d90c2c93d908ae840479..706d98e0899f48095b30e456a8fa206dae997fb8 100644 --- a/en/application-dev/reference/apis/js-apis-file-fs.md +++ b/en/application-dev/reference/apis/js-apis-file-fs.md @@ -15,7 +15,7 @@ import fs from '@ohos.file.fs'; ## Guidelines -Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the application sandbox as follows: +Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the file or directory in the application sandbox as follows: **Stage Model** @@ -147,7 +147,7 @@ Checks whether a file exists. This API uses a promise to return the result. | Type | Description | | ------------------- | ---------------------------- | -| Promise<boolean> | Promise used to return a Boolean value. | +| Promise<boolean> | Promise used to return a Boolean value.| **Example** @@ -1079,7 +1079,7 @@ Reads the text content of a file. This API uses an asynchronous callback to retu | -------- | --------------------------- | ---- | ------------------------------------------------------------ | | filePath | string | Yes | Path of the file in the application sandbox. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.
- **encoding** (string): format of the string to be encoded. The default value is **'utf-8'**, which is the only value supported.| -| callback | AsyncCallback<string> | Yes | Callback used to return the content read. | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the content read. | **Example** @@ -1169,7 +1169,7 @@ Obtains information about a symbolic link. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | -------------------------------------- | | path | string | Yes | Path of the symbolic link in the application sandbox.| -| callback | AsyncCallback<[Stat](#stat)> | Yes | Callback used to return the symbolic link information obtained. | +| callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the symbolic link information obtained. | **Example** @@ -1215,7 +1215,7 @@ Obtains information about a symbolic link synchronously. rename(oldPath: string, newPath: string): Promise<void> -Renames a file. This API uses a promise to return the result. +Renames a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1248,7 +1248,7 @@ Renames a file. This API uses a promise to return the result. rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void -Renames a file. This API uses an asynchronous callback to return the result. +Renames a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1278,7 +1278,7 @@ Renames a file. This API uses an asynchronous callback to return the result. renameSync(oldPath: string, newPath: string): void -Synchronously renames a file. +Renames a file or directory synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1366,7 +1366,7 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return fsyncSync(fd: number): void -Flushes data of a file to disk in synchronous mode. +Flushes data of a file to disk synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1454,7 +1454,7 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return fdatasyncSync(fd: number): void -Synchronizes data in a file in synchronous mode. +Synchronizes data in a file synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO diff --git a/en/application-dev/reference/apis/js-apis-file-statvfs.md b/en/application-dev/reference/apis/js-apis-file-statvfs.md index 8241f4734312251f1d4dce13888a2e8ce521ca90..f431f3cb17d8d82a88a0b9bde7e2a3e3d8e66c86 100644 --- a/en/application-dev/reference/apis/js-apis-file-statvfs.md +++ b/en/application-dev/reference/apis/js-apis-file-statvfs.md @@ -36,14 +36,14 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ```js let path = "/dev"; - statfs.getFreeSize(path).then((number) => { + statvfs.getFreeSize(path).then((number) => { console.info("getFreeSize promise successfully, Size: " + number); }).catch((err) => { console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); }); ``` -## statfs.getFreeSize +## statvfs.getFreeSize getFreeSize(path:string, callback:AsyncCallback<number>): void @@ -62,7 +62,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ```js let path = "/dev"; - statfs.getFreeSize(path, (err, number) => { + statvfs.getFreeSize(path, (err, number) => { if (err) { console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -71,7 +71,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo }); ``` -## statfs.getTotalSize +## statvfs.getTotalSize getTotalSize(path: string): Promise<number> @@ -95,14 +95,14 @@ Obtains the total number of bytes of the specified file system in asynchronous m ```js let path = "/dev"; - statfs.getTotalSize(path).then((number) => { + statvfs.getTotalSize(path).then((number) => { console.info("getTotalSize promise successfully, Size: " + number); }).catch((err) => { console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); }); ``` -## statfs.getTotalSize +## statvfs.getTotalSize getTotalSize(path: string, callback: AsyncCallback<number>): void @@ -121,7 +121,7 @@ Obtains the total number of bytes of the specified file system in asynchronous m ```js let path = "/dev"; - statfs.getTotalSize(path, (err, number) => { + statvfs.getTotalSize(path, (err, number) => { if (err) { console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); } else { diff --git a/en/application-dev/reference/apis/js-apis-fileAccess.md b/en/application-dev/reference/apis/js-apis-fileAccess.md index d064302086186e5bcd33f50aade78f58376a6ce4..7cc6188dd1958ba7a158f7b06236206e8055fc9e 100644 --- a/en/application-dev/reference/apis/js-apis-fileAccess.md +++ b/en/application-dev/reference/apis/js-apis-fileAccess.md @@ -17,7 +17,7 @@ import fileAccess from '@ohos.file.fileAccess'; getFileAccessAbilityInfo( ) : Promise<Array<Want>> -Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses a promise to return the result. +Obtains information about all wants with **extension** set to **fileAccess** in the system. A want is a basic communication component used to start services. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -47,7 +47,7 @@ Obtains information about all wants with **extension** set to **fileAcesss** in getFileAccessAbilityInfo(callback: AsyncCallback<Array<Want>>): void; -Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result. +Obtains information about all wants with **extension** set to **fileAccess** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -114,7 +114,7 @@ Synchronously creates a **Helper** object to connect to the specified wants. The }, ] try { - // this.context is passed by MainAbility. + // this.context is passed by EntryAbility. fileAccessHelper = fileAccess.createFileAccessHelper(this.context, wantInfos); if (!fileAccessHelper) console.error("createFileAccessHelper interface returns an undefined object"); @@ -150,12 +150,12 @@ Synchronously creates a **Helper** object to connect to all file management serv ```js createFileAccessHelper() { - let fileAccesssHelperAllServer = null; + let fileAccessHelperAllServer = null; // Create a Helper object to interact with all file management services configured with fileAccess in the system. try { - // this.context is passed by MainAbility. - fileAccesssHelperAllServer = fileAccess.createFileAccessHelper(this.context); - if (!fileAccesssHelperAllServer) + // this.context is passed by EntryAbility. + fileAccessHelperAllServer = fileAccess.createFileAccessHelper(this.context); + if (!fileAccessHelperAllServer) console.error("createFileAccessHelper interface returns an undefined object"); } catch (error) { console.error("createFileAccessHelper failed, errCode:" + error.code + ", errMessage:" + error.message); @@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv getRoots( ) : Promise<RootIterator> -Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses a promise to return a **RootIterator** object, which -returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext). +Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses a promise to return a **RootIterator** object, which returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -212,6 +211,7 @@ returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext). getRoots(callback:AsyncCallback<RootIterator>) : void; Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. + The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -255,7 +255,7 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) listFile(filter?: Filter) : FileIterator -Synchronously obtains the **FileIterator** object of the first-level files (file folder) matching the conditions of the filter from the device root node. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). +Synchronously obtains the **FileIterator** object of the first-level files (directory) matching the conditions of the filter from the device root node. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -356,7 +356,7 @@ Recursively obtains the **FileIterator** object of the files matching the condit listFile(filter?: Filter) : FileIterator -Synchronously obtains the **FileIterator** object of the next-level files (file folders) matching the conditions of the filter from a directory. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). +Synchronously obtains the **FileIterator** object of the next-level files (directories) matching the conditions of the filter from a directory. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -542,7 +542,7 @@ Creates a file in a directory. This API uses an asynchronous callback to return mkDir(parentUri: string, displayName: string) : Promise<string> -Creates a folder in a directory. This API uses a promise to return the result. +Creates a directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -552,14 +552,14 @@ Creates a folder in a directory. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | parentUri | string | Yes| URI of the parent directory for the folder to create.| - | displayName | string | Yes| Name of the folder to create.| + | parentUri | string | Yes| URI of the parent directory for the directory to create.| + | displayName | string | Yes| Name of the directory to create.| **Return value** | Type| Description| | --- | -- | -| Promise<string> | Promise used to return the URI of the folder created.| +| Promise<string> | Promise used to return the URI of the directory created.| **Example** @@ -587,7 +587,7 @@ Creates a folder in a directory. This API uses a promise to return the result. mkDir(parentUri: string, displayName: string, callback: AsyncCallback<string>) : void; -Creates a folder in a directory. This API uses an asynchronous callback to return the result. +Creates a directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -597,9 +597,9 @@ Creates a folder in a directory. This API uses an asynchronous callback to retur | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | parentUri | string | Yes| URI of the parent directory for the folder to create.| - | displayName | string | Yes| Name of the folder to create.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the folder created.| + | parentUri | string | Yes| URI of the parent directory for the directory to create.| + | displayName | string | Yes| Name of the directory to create.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the directory created.| **Example** @@ -677,7 +677,7 @@ Opens a file. This API uses an asynchronous callback to return the result. | --- | --- | --- | -- | | uri | string | Yes| URI of the file to open.| | flags | [OPENFLAGS](#openflags) | Yes| File open mode.| - | callback | AsyncCallback<number> | Yes| Promise used to return the file descriptor of the file opened.| + | callback | AsyncCallback<number> | Yes| Callback invoked to return the file descriptor of the file opened.| **Example** @@ -704,7 +704,7 @@ Opens a file. This API uses an asynchronous callback to return the result. delete(uri: string) : Promise<number> -Deletes a file or folder. This API uses a promise to return the result. +Deletes a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -714,7 +714,7 @@ Deletes a file or folder. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or folder to delete.| + | uri | string | Yes| URI of the file or directory to delete.| **Return value** @@ -743,7 +743,7 @@ Deletes a file or folder. This API uses a promise to return the result. delete(uri: string, callback: AsyncCallback<number>) : void; -Deletes a file or folder. This API uses an asynchronous callback to return the result. +Deletes a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -753,7 +753,7 @@ Deletes a file or folder. This API uses an asynchronous callback to return the r | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or folder to delete.| + | uri | string | Yes| URI of the file or directory to delete.| | callback | AsyncCallback<number> | Yes| Promise used to return the result.| **Example** @@ -781,7 +781,7 @@ Deletes a file or folder. This API uses an asynchronous callback to return the r move(sourceFile: string, destFile: string) : Promise<string> -Moves a file or folder. This API uses a promise to return the result. +Moves a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -791,20 +791,20 @@ Moves a file or folder. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | sourceFile | string | Yes| URI of the file or folder to move.| - | destFile | string | Yes| URI of the folder to which the file or folder will be moved.| + | sourceFile | string | Yes| URI of the file or directory to move.| + | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| **Return value** | Type| Description| | ----- | ------ | -| Promise<string> | Promise used to return the URI of the file or folder in the destination directory.| +| Promise<string> | Promise used to return the URI of the file or directory in the destination directory.| **Example** ```js // The media library URI is used as an example. - //In the sample code, sourceFile destFile indicates the file or folder in the Download directory. The URI is the URI in fileInfo. + //In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceFile = "datashare:///media/file/102"; let destFile = "datashare:///media/file/101"; @@ -821,7 +821,7 @@ Moves a file or folder. This API uses a promise to return the result. move(sourceFile: string, destFile: string, callback: AsyncCallback<string>) : void; -Moves a file or folder. This API uses an asynchronous callback to return the result. +Moves a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -831,15 +831,15 @@ Moves a file or folder. This API uses an asynchronous callback to return the res | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | sourceFile | string | Yes| URI of the file or folder to move.| - | destFile | string | Yes| URI of the folder to which the file or folder will be moved.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or folder in the destination directory.| + | sourceFile | string | Yes| URI of the file or directory to move.| + | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or directory in the destination directory.| **Example** ```js // The media library URI is used as an example. - //In the sample code, sourceFile destFile indicates the file or folder in the Download directory. The URI is the URI in fileInfo. + //In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceFile = "datashare:///media/file/102"; let destFile = "datashare:///media/file/101"; @@ -861,7 +861,7 @@ Moves a file or folder. This API uses an asynchronous callback to return the res rename(uri: string, displayName: string) : Promise<string> -Renames a file or folder. This API uses a promise to return the result. +Renames a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -871,14 +871,14 @@ Renames a file or folder. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or folder to rename.| - | displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| + | uri | string | Yes| URI of the file or directory to rename.| + | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| **Return value** | Type| Description| | --- | -- | -| Promise<string> | Promise used to return the URI of the renamed file or folder.| +| Promise<string> | Promise used to return the URI of the renamed file or directory.| **Example** @@ -900,7 +900,7 @@ Renames a file or folder. This API uses a promise to return the result. rename(uri: string, displayName: string, callback: AsyncCallback<string>) : void; -Renames a file or folder. This API uses an asynchronous callback to return the result. +Renames a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -910,9 +910,9 @@ Renames a file or folder. This API uses an asynchronous callback to return the r | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or folder to rename.| - | displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or folder.| + | uri | string | Yes| URI of the file or directory to rename.| + | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or directory.| **Example** @@ -939,7 +939,7 @@ Renames a file or folder. This API uses an asynchronous callback to return the r access(sourceFileUri: string) : Promise<boolean> -Checks whether a file or folder exists. This API uses a promise to return the result. +Checks whether a file or directory exists. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -949,7 +949,7 @@ Checks whether a file or folder exists. This API uses a promise to return the re | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | sourceFileUri | string | Yes| URI of the file or folder.| + | sourceFileUri | string | Yes| URI of the file or directory.| **Return value** @@ -980,7 +980,7 @@ Checks whether a file or folder exists. This API uses a promise to return the re access(sourceFileUri: string, callback: AsyncCallback<boolean>) : void; -Checks whether a file or folder exists. This API uses an asynchronous callback to return the result. +Checks whether a file or directory exists. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -990,7 +990,7 @@ Checks whether a file or folder exists. This API uses an asynchronous callback t | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | sourceFileUri | string | Yes| URI of the file or folder.| + | sourceFileUri | string | Yes| URI of the file or directory.| | callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| **Example** @@ -1031,13 +1031,13 @@ Obtains the next-level device root directory. **RootIterator** is an iterator ob | Type| Description| | --- | -- | -| {value: RootInfo, done: boolean} | Root directory information obtained. This API traverses the folder until **done** returns **true**. The **value** field contains the root directory information.| +| {value: RootInfo, done: boolean} | Root directory information obtained. This API traverses the directory until **done** returns **true**. The **value** field contains the root directory information.| ## FileIterator.next next( ) : { value: FileInfo, done: boolean } -Obtains the information about the next-level file or folder. **FileIterator** is an iterator object of a folder. +Obtains the information about the next-level file or directory. **FileIterator** is an iterator object of a directory. **System capability**: SystemCapability.FileManagement.UserFileService @@ -1047,7 +1047,7 @@ Obtains the information about the next-level file or folder. **FileIterator** is | Type| Description| | --- | -- | -| {value: FileInfo, done: boolean} | File or folder information obtained. This API traverses the specified folder until **done** returns **true**. The **value** field contains the file or folder information obtained.| +| {value: FileInfo, done: boolean} | File or directory information obtained. This API traverses the specified directory until **done** returns **true**. The **value** field contains the file or directory information obtained.| ## RootInfo @@ -1068,7 +1068,7 @@ Represents the root attribute information and interface capabilities of a device ## FileInfo -Represents the file or folder attribute information and interface capabilities. +Represents the file or directory attribute information and interface capabilities. **System capability**: SystemCapability.FileManagement.UserFileService @@ -1078,12 +1078,12 @@ Represents the file or folder attribute information and interface capabilities. | Name| Type | Readable| Writable| Description | | ------ | ------ | -------- | ------ | -------- | -| uri | string | Yes| No| URI of the file or folder.| -| fileName | string | Yes| No| Name of a file or folder.| -| mode | number | Yes| No| Permissions on the file or folder.| -| size | number | Yes| No| Size of the file or folder.| -| mtime | number | Yes| No| Time when the file or folder was last modified.| -| mimeType | string | Yes| No| MIME type of the file or folder.| +| uri | string | Yes| No| URI of the file or directory.| +| fileName | string | Yes| No| Name of a file or directory.| +| mode | number | Yes| No| Permissions on the file or directory.| +| size | number | Yes| No| Size of the file or directory.| +| mtime | number | Yes| No| Time when the file or directory was last modified.| +| mimeType | string | Yes| No| MIME type of the file or directory.| ## OPENFLAGS