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.
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.
| 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.|
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
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.
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**<br>
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2).
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2).
| 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.|
| 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**
**Example**
...
@@ -2871,7 +2905,7 @@ Deletes an app account. This API uses a promise to return the result.
...
@@ -2871,7 +2905,7 @@ Deletes an app account. This API uses a promise to return the result.
| Name | Type | Mandatory | Description |
| 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**
**Return value**
...
@@ -3756,18 +3790,23 @@ Authenticates an app account with customized options. This API uses an asynchron
...
@@ -3756,18 +3790,23 @@ Authenticates an app account with customized options. This API uses an asynchron
| KEY_BOOLEAN_RESULT<sup>9+</sup> | "booleanResult" | Return value of the Boolean type. |
| KEY_BOOLEAN_RESULT<sup>9+</sup> | "booleanResult" | Return value of the Boolean type. |
## ResultCode<sup>8+</sup>
## ResultCode<sup>(deprecated)</sup>
Enumerates the result codes.
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).
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**
**Stage Model**
...
@@ -147,7 +147,7 @@ Checks whether a file exists. This API uses a promise to return the result.
...
@@ -147,7 +147,7 @@ Checks whether a file exists. This API uses a promise to return the result.
| filePath | string | Yes | Path of the file in the application sandbox. |
| filePath | string | Yes | Path of the file in the application sandbox. |
| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.<br>- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.<br>- **encoding** (string): format of the string to be encoded. The default value is **'utf-8'**, which is the only value supported.|
| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.<br>- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.<br>- **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**
**Example**
...
@@ -1169,7 +1169,7 @@ Obtains information about a symbolic link. This API uses an asynchronous callbac
...
@@ -1169,7 +1169,7 @@ Obtains information about a symbolic link. This API uses an asynchronous callbac
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.
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.
@@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv
...
@@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv
getRoots( ) : Promise<RootIterator>
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
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).
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 an asynchronous callback to return the result.
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).
The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext).
@@ -255,7 +255,7 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo)
...
@@ -255,7 +255,7 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo)
listFile(filter?: Filter) : FileIterator
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).
@@ -356,7 +356,7 @@ Recursively obtains the **FileIterator** object of the files matching the condit
...
@@ -356,7 +356,7 @@ Recursively obtains the **FileIterator** object of the files matching the condit
listFile(filter?: Filter) : FileIterator
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).
@@ -990,7 +990,7 @@ Checks whether a file or folder exists. This API uses an asynchronous callback t
...
@@ -990,7 +990,7 @@ Checks whether a file or folder exists. This API uses an asynchronous callback t
| Name| Type| Mandatory| Description|
| 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.|
| callback | AsyncCallback<boolean> | Yes| Promise used to return the result.|
**Example**
**Example**
...
@@ -1031,13 +1031,13 @@ Obtains the next-level device root directory. **RootIterator** is an iterator ob
...
@@ -1031,13 +1031,13 @@ Obtains the next-level device root directory. **RootIterator** is an iterator ob
| Type| Description|
| 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
## FileIterator.next
next( ) : { value: FileInfo, done: boolean }
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.
@@ -1047,7 +1047,7 @@ Obtains the information about the next-level file or folder. **FileIterator** is
...
@@ -1047,7 +1047,7 @@ Obtains the information about the next-level file or folder. **FileIterator** is
| Type| Description|
| 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
## RootInfo
...
@@ -1068,7 +1068,7 @@ Represents the root attribute information and interface capabilities of a device
...
@@ -1068,7 +1068,7 @@ Represents the root attribute information and interface capabilities of a device
## FileInfo
## FileInfo
Represents the file or folder attribute information and interface capabilities.
Represents the file or directory attribute information and interface capabilities.