提交 05091d52 编写于 作者: A annie_wangli

update docs

Signed-off-by: Nannie_wangli <annie.wangli@huawei.com>
上级 fcbcccd5
...@@ -45,13 +45,13 @@ Asynchronously obtains file information. This method uses a promise to return th ...@@ -45,13 +45,13 @@ Asynchronously obtains file information. This method uses a promise to return th
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------- | ---------- |
| Promise&lt;[Stat](#stat)&gt; | Promise used to return the file information obtained.| | Promise&lt;[Stat](#stat)&gt; | Promise used to return the file information obtained.|
- Example - Example
...@@ -73,10 +73,10 @@ Asynchronously obtains file information. This method uses a callback to return t ...@@ -73,10 +73,10 @@ Asynchronously obtains file information. This method uses a callback to return t
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------- | ---- | --------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes| Callback invoked to return the file information obtained.| | callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes | Callback invoked to return the file information obtained.|
- Example - Example
```js ```js
...@@ -95,14 +95,14 @@ Synchronously obtains file information. ...@@ -95,14 +95,14 @@ Synchronously obtains file information.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------- | ---------- |
| [Stat](#stat) | File information obtained.| | [Stat](#stat) | File information obtained.|
- Example - Example
...@@ -121,13 +121,13 @@ Asynchronously opens a directory. This method uses a promise to return the resul ...@@ -121,13 +121,13 @@ Asynchronously opens a directory. This method uses a promise to return the resul
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------- |
| path | string | Yes| Absolute path of the directory to open.| | path | string | Yes | Absolute path of the directory to open.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | -------------------------- | -------- |
| Promise&lt;[Dir](#dir)&gt; | A **Dir** instance corresponding to the directory.| | Promise&lt;[Dir](#dir)&gt; | A **Dir** instance corresponding to the directory.|
- Example - Example
...@@ -149,10 +149,10 @@ Asynchronously opens a directory. This method uses a callback to return the resu ...@@ -149,10 +149,10 @@ Asynchronously opens a directory. This method uses a callback to return the resu
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------------------------------- | ---- | -------------- |
| path | string | Yes| Absolute path of the directory to open.| | path | string | Yes | Absolute path of the directory to open. |
| callback | AsyncCallback&lt;[Dir](#dir)&gt; | Yes| Callback invoked when the directory is open asynchronously.| | callback | AsyncCallback&lt;[Dir](#dir)&gt; | Yes | Callback invoked when the directory is open asynchronously.|
- Example - Example
```js ```js
...@@ -173,13 +173,13 @@ Synchronously opens a directory. ...@@ -173,13 +173,13 @@ Synchronously opens a directory.
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------- |
| path | string | Yes| Absolute path of the directory to open.| | path | string | Yes | Absolute path of the directory to open.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ----------- | -------- |
| [Dir](#dir) | A **Dir** instance corresponding to the directory.| | [Dir](#dir) | A **Dir** instance corresponding to the directory.|
- Example - Example
...@@ -199,14 +199,14 @@ Asynchronously checks whether the current process can access a file. This method ...@@ -199,14 +199,14 @@ Asynchronously checks whether the current process can access a file. This method
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | number | No| Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (&#124;). The default value is **0**.<br>The options are as follows:<br>-&nbsp;**0**: check whether the file exists.<br>-&nbsp;**1**: check whether the current process has the execute permission on the file.<br>-&nbsp;**2**: check whether the current process has the write permission on the file.<br>-&nbsp;**4**: check whether the current process has the read permission on the file.| | mode | number | No | Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (&#124;). The default value is **0**.<br>The options are as follows:<br>-&nbsp;**0**: check whether the file exists.<br>-&nbsp;**1**: check whether the current process has the execute permission on the file.<br>-&nbsp;**2**: check whether the current process has the write permission on the file.<br>-&nbsp;**4**: check whether the current process has the read permission on the file.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -228,11 +228,11 @@ Asynchronously checks whether the current process can access a file. This method ...@@ -228,11 +228,11 @@ Asynchronously checks whether the current process can access a file. This method
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | number | No| Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (&#124;). The default value is **0**.<br>The options are as follows:<br>-&nbsp;**0**: check whether the file exists.<br>-&nbsp;**1**: check whether the current process has the execute permission on the file.<br>-&nbsp;**2**: check whether the current process has the write permission on the file.<br>-&nbsp;**4**: check whether the current process has the read permission on the file.| | mode | number | No | Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (&#124;). The default value is **0**.<br>The options are as follows:<br>-&nbsp;**0**: check whether the file exists.<br>-&nbsp;**1**: check whether the current process has the execute permission on the file.<br>-&nbsp;**2**: check whether the current process has the write permission on the file.<br>-&nbsp;**4**: check whether the current process has the read permission on the file.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is asynchronously checked.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is asynchronously checked. |
- Example - Example
```js ```js
...@@ -251,10 +251,10 @@ Synchronously checks whether the current process can access the specified file. ...@@ -251,10 +251,10 @@ Synchronously checks whether the current process can access the specified file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | number | No| Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (&#124;). The default value is **0**.<br>The options are as follows:<br>-&nbsp;**0**: check whether the file exists.<br>-&nbsp;**1**: check whether the current process has the execute permission on the file.<br>-&nbsp;**2**: check whether the current process has the write permission on the file.<br>-&nbsp;**4**: check whether the current process has the read permission on the file.| | mode | number | No | Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (&#124;). The default value is **0**.<br>The options are as follows:<br>-&nbsp;**0**: check whether the file exists.<br>-&nbsp;**1**: check whether the current process has the execute permission on the file.<br>-&nbsp;**2**: check whether the current process has the write permission on the file.<br>-&nbsp;**4**: check whether the current process has the read permission on the file.|
- Example - Example
```js ```js
...@@ -275,13 +275,13 @@ Asynchronously closes a file. This method uses a promise to return the result. ...@@ -275,13 +275,13 @@ Asynchronously closes a file. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to close.| | fd | number | Yes | File descriptor of the file to close.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -304,10 +304,10 @@ Asynchronously closes a file. This method uses a callback to return the result. ...@@ -304,10 +304,10 @@ Asynchronously closes a file. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to close.| | fd | number | Yes | File descriptor of the file to close.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is closed asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is closed asynchronously.|
- Example - Example
```js ```js
...@@ -327,9 +327,9 @@ Synchronously closes a file. ...@@ -327,9 +327,9 @@ Synchronously closes a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to close.| | fd | number | Yes | File descriptor of the file to close.|
- Example - Example
```js ```js
...@@ -346,8 +346,8 @@ Asynchronously closes the stream. This method uses a promise to return the resul ...@@ -346,8 +346,8 @@ Asynchronously closes the stream. This method uses a promise to return the resul
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -369,9 +369,9 @@ Asynchronously closes the stream. This method uses a callback to return the resu ...@@ -369,9 +369,9 @@ Asynchronously closes the stream. This method uses a callback to return the resu
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ------------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the stream is closed asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the stream is closed asynchronously.|
- Example - Example
```js ```js
...@@ -390,15 +390,15 @@ Asynchronously copies a file. This method uses a promise to return the result. ...@@ -390,15 +390,15 @@ Asynchronously copies a file. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | -------------------------- | ---- | ---------------------------------------- |
| src | string&nbsp;\|&nbsp;number | Yes| Path or file descriptor of the file to copy.| | src | string&nbsp;\|&nbsp;number | Yes | Path or file descriptor of the file to copy. |
| dest | string&nbsp;\|&nbsp;number | Yes| Path or file descriptor of the new file.| | dest | string&nbsp;\|&nbsp;number | Yes | Path or file descriptor of the new file. |
| mode | number | No| Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.<br>**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.| | mode | number | No | Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.<br>**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -420,12 +420,12 @@ Asynchronously copies a file. This method uses a callback to return the result. ...@@ -420,12 +420,12 @@ Asynchronously copies a file. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------------------------- | ---- | ---------------------------------------- |
| src | string&nbsp;\|&nbsp;number | Yes| Path or file descriptor of the file to copy.| | src | string&nbsp;\|&nbsp;number | Yes | Path or file descriptor of the file to copy. |
| dest | string&nbsp;\|&nbsp;number | Yes| Path or file descriptor of the new file.| | dest | string&nbsp;\|&nbsp;number | Yes | Path or file descriptor of the new file. |
| mode | number | No| Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.<br>**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.| | mode | number | No | Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.<br>**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is copied asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is copied asynchronously. |
- Example - Example
```js ```js
...@@ -444,11 +444,11 @@ Synchronously copies a file. ...@@ -444,11 +444,11 @@ Synchronously copies a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | -------------------------- | ---- | ---------------------------------------- |
| src | string&nbsp;\|&nbsp;number | Yes| Path or file descriptor of the file to copy.| | src | string&nbsp;\|&nbsp;number | Yes | Path or file descriptor of the file to copy. |
| dest | string&nbsp;\|&nbsp;number | Yes| Path or file descriptor of the new file.| | dest | string&nbsp;\|&nbsp;number | Yes | Path or file descriptor of the new file. |
| mode | number | No| Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.<br>**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.| | mode | number | No | Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.<br>**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.|
- Example - Example
```js ```js
...@@ -465,14 +465,14 @@ Asynchronously creates a directory. This method uses a promise to return the res ...@@ -465,14 +465,14 @@ Asynchronously creates a directory. This method uses a promise to return the res
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the directory to create.| | path | string | Yes | Absolute path of the directory to create. |
| mode | number | No| Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o775**.<br>-&nbsp;**0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | No | Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o775**.<br>-&nbsp;**0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -494,11 +494,11 @@ Asynchronously creates a directory. This method uses a callback to return the re ...@@ -494,11 +494,11 @@ Asynchronously creates a directory. This method uses a callback to return the re
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the directory to create.| | path | string | Yes | Absolute path of the directory to create. |
| mode | number | No| Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o775**.<br>-&nbsp;**0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | No | Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o775**.<br>-&nbsp;**0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the directory is created asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the directory is created asynchronously. |
- Example - Example
```js ```js
...@@ -519,10 +519,10 @@ Synchronously creates a directory. ...@@ -519,10 +519,10 @@ Synchronously creates a directory.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the directory to create.| | path | string | Yes | Absolute path of the directory to create. |
| mode | number | No| Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o775**.<br>-&nbsp;**0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | No | Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o775**.<br>-&nbsp;**0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Example - Example
```js ```js
...@@ -539,15 +539,15 @@ Asynchronously opens a file. This method uses a promise to return the result. ...@@ -539,15 +539,15 @@ Asynchronously opens a file. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| flags | number | No| Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.<br>-&nbsp;**0o0**: Open the file in read-only mode.<br>-&nbsp;**0o1**: Open the file in write-only mode.<br>-&nbsp;**0o2**: Open the file in read/write mode.<br>In addition, you can specify the following options, separated using a bitwise OR operator (&#124;). By default, no additional option is specified.<br>-&nbsp;**0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.<br>-&nbsp;**0o200**: If **0o100** is added and the file already exists, throw an exception.<br>-&nbsp;**0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>-&nbsp;**0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).<br>-&nbsp;**0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.<br>-&nbsp;**0o200000**: If **path** points to a directory, throw an exception.<br><br/>-&nbsp;**0o400000**: If **path** points to a symbolic link, throw an exception.<br>-&nbsp;**0o4010000**: Open the file in synchronous I/O mode.| | flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.<br>-&nbsp;**0o0**: Open the file in read-only mode.<br>-&nbsp;**0o1**: Open the file in write-only mode.<br>-&nbsp;**0o2**: Open the file in read/write mode.<br>In addition, you can specify the following options, separated using a bitwise OR operator (&#124;). By default, no additional option is specified.<br>-&nbsp;**0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.<br>-&nbsp;**0o200**: If **0o100** is added and the file already exists, throw an exception.<br>-&nbsp;**0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>-&nbsp;**0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).<br>-&nbsp;**0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.<br>-&nbsp;**0o200000**: If **path** points to a directory, throw an exception.<br><br/>-&nbsp;**0o400000**: If **path** points to a symbolic link, throw an exception.<br>-&nbsp;**0o4010000**: Open the file in synchronous I/O mode.|
| mode | number | No| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o666**.<br>-&nbsp;**0o666**: The owner, user group, and other users have the read and write permissions on the file.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | No | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o666**.<br>-&nbsp;**0o666**: The owner, user group, and other users have the read and write permissions on the file.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | ----------- |
| Promise&lt;number&gt; | File descriptor of the file opened.| | Promise&lt;number&gt; | File descriptor of the file opened.|
- Example - Example
...@@ -569,12 +569,12 @@ Asynchronously opens a file. This method uses a callback to return the result. ...@@ -569,12 +569,12 @@ Asynchronously opens a file. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------------- | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| flags | number | Yes| Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.<br>-&nbsp;**0o0**: Open the file in read-only mode.<br>-&nbsp;**0o1**: Open the file in write-only mode.<br>-&nbsp;**0o2**: Open the file in read/write mode.<br>In addition, you can specify the following options, separated using a bitwise OR operator (&#124;). By default, no additional option is specified.<br>-&nbsp;**0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.<br>-&nbsp;**0o200**: If **0o100** is added and the file already exists, throw an exception.<br>-&nbsp;**0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>-&nbsp;**0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).<br>-&nbsp;**0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.<br>-&nbsp;**0o200000**: If **path** points to a directory, throw an exception.<br><br/>-&nbsp;**0o400000**: If **path** points to a symbolic link, throw an exception.<br>-&nbsp;**0o4010000**: Open the file in synchronous I/O mode.| | flags | number | Yes | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.<br>-&nbsp;**0o0**: Open the file in read-only mode.<br>-&nbsp;**0o1**: Open the file in write-only mode.<br>-&nbsp;**0o2**: Open the file in read/write mode.<br>In addition, you can specify the following options, separated using a bitwise OR operator (&#124;). By default, no additional option is specified.<br>-&nbsp;**0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.<br>-&nbsp;**0o200**: If **0o100** is added and the file already exists, throw an exception.<br>-&nbsp;**0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>-&nbsp;**0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).<br>-&nbsp;**0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.<br>-&nbsp;**0o200000**: If **path** points to a directory, throw an exception.<br><br/>-&nbsp;**0o400000**: If **path** points to a symbolic link, throw an exception.<br>-&nbsp;**0o4010000**: Open the file in synchronous I/O mode.|
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o666**.<br>-&nbsp;**0o666**: The owner, user group, and other users have the read and write permissions on the file.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o666**.<br>-&nbsp;**0o666**: The owner, user group, and other users have the read and write permissions on the file.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
| callback | AsyncCallback&nbsp;&lt;void&gt; | Yes| Callback invoked when the file is open asynchronously.| | callback | AsyncCallback&nbsp;&lt;void&gt; | Yes | Callback invoked when the file is open asynchronously. |
- Example - Example
```js ```js
...@@ -593,15 +593,15 @@ Synchronously opens a file. ...@@ -593,15 +593,15 @@ Synchronously opens a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| flags | number | No| Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.<br>-&nbsp;**0o0**: Open the file in read-only mode.<br>-&nbsp;**0o1**: Open the file in write-only mode.<br>-&nbsp;**0o2**: Open the file in read/write mode.<br>In addition, you can specify the following options, separated using a bitwise OR operator (&#124;). By default, no additional option is specified.<br>-&nbsp;**0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.<br>-&nbsp;**0o200**: If **0o100** is added and the file already exists, throw an exception.<br>-&nbsp;**0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>-&nbsp;**0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).<br>-&nbsp;**0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.<br>-&nbsp;**0o200000**: If **path** points to a directory, throw an exception.<br><br/>-&nbsp;**0o400000**: If **path** points to a symbolic link, throw an exception.<br>-&nbsp;**0o4010000**: Open the file in synchronous I/O mode.| | flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.<br>-&nbsp;**0o0**: Open the file in read-only mode.<br>-&nbsp;**0o1**: Open the file in write-only mode.<br>-&nbsp;**0o2**: Open the file in read/write mode.<br>In addition, you can specify the following options, separated using a bitwise OR operator (&#124;). By default, no additional option is specified.<br>-&nbsp;**0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.<br>-&nbsp;**0o200**: If **0o100** is added and the file already exists, throw an exception.<br>-&nbsp;**0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>-&nbsp;**0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).<br>-&nbsp;**0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.<br>-&nbsp;**0o200000**: If **path** points to a directory, throw an exception.<br><br/>-&nbsp;**0o400000**: If **path** points to a symbolic link, throw an exception.<br>-&nbsp;**0o4010000**: Open the file in synchronous I/O mode.|
| mode | number | No| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o666**.<br>-&nbsp;**0o666**: The owner, user group, and other users have the read and write permissions on the file.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.<br>The file permissions on newly created files are affected by umask, which is set as the process starts. Currently, the modification of umask is not open.| | mode | number | No | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o666**.<br>-&nbsp;**0o666**: The owner, user group, and other users have the read and write permissions on the file.<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.<br>The file permissions on newly created files are affected by umask, which is set as the process starts. Currently, the modification of umask is not open.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------ | ----------- |
| number | File descriptor of the file opened.| | number | File descriptor of the file opened.|
- Example - Example
...@@ -623,15 +623,15 @@ Asynchronously reads data from a file. This method uses a promise to return the ...@@ -623,15 +623,15 @@ Asynchronously reads data from a file. This method uses a promise to return the
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ----------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the file to read.| | fd | number | Yes | File descriptor of the file to read. |
| buffer | ArrayBuffer | Yes| Buffer used to store the file data read.| | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.| | options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------- | ------ |
| Promise&lt;[ReadOut](#readout)&gt; | Data read.| | Promise&lt;[ReadOut](#readout)&gt; | Data read.|
- Example - Example
...@@ -659,12 +659,12 @@ Asynchronously reads data from a file. This method uses a callback to return the ...@@ -659,12 +659,12 @@ Asynchronously reads data from a file. This method uses a callback to return the
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the file to read.| | fd | number | Yes | File descriptor of the file to read. |
| buffer | ArrayBuffer | Yes| Buffer used to store the file data read.| | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.| | options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.|
| callback | AsyncCallback&lt;[ReadOut](#readout)&gt; | Yes| Callback invoked when the data is read asynchronously.| | callback | AsyncCallback&lt;[ReadOut](#readout)&gt; | Yes | Callback invoked when the data is read asynchronously. |
- Example - Example
```js ```js
...@@ -691,15 +691,15 @@ Synchronously reads data from a file. ...@@ -691,15 +691,15 @@ Synchronously reads data from a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ----------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the file to read.| | fd | number | Yes | File descriptor of the file to read. |
| buffer | ArrayBuffer | Yes| Buffer used to store the file data read.| | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.| | options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------ | -------- |
| number | Length of the data read.| | number | Length of the data read.|
- Example - Example
...@@ -719,13 +719,13 @@ Asynchronously deletes a directory. This method uses a promise to return the res ...@@ -719,13 +719,13 @@ Asynchronously deletes a directory. This method uses a promise to return the res
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the directory to delete.| | path | string | Yes | Absolute path of the directory to delete.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -747,10 +747,10 @@ Asynchronously deletes a directory. This method uses a callback to return the re ...@@ -747,10 +747,10 @@ Asynchronously deletes a directory. This method uses a callback to return the re
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ------------ |
| path | string | Yes| Absolute path of the directory to delete.| | path | string | Yes | Absolute path of the directory to delete. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the directory is deleted asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the directory is deleted asynchronously.|
- Example - Example
```js ```js
...@@ -769,9 +769,9 @@ Synchronously deletes a directory. ...@@ -769,9 +769,9 @@ Synchronously deletes a directory.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the directory to delete.| | path | string | Yes | Absolute path of the directory to delete.|
- Example - Example
```js ```js
...@@ -788,13 +788,13 @@ Asynchronously deletes a file. This method uses a promise to return the result. ...@@ -788,13 +788,13 @@ Asynchronously deletes a file. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the file to delete.| | path | string | Yes | Absolute path of the file to delete.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -816,10 +816,10 @@ Asynchronously deletes a file. This method uses a callback to return the result. ...@@ -816,10 +816,10 @@ Asynchronously deletes a file. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ------------ |
| path | string | Yes| Absolute path of the file to delete.| | path | string | Yes | Absolute path of the file to delete. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is deleted asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is deleted asynchronously.|
- Example - Example
```js ```js
...@@ -840,9 +840,9 @@ Synchronously deletes a file. ...@@ -840,9 +840,9 @@ Synchronously deletes a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the file to delete.| | path | string | Yes | Absolute path of the file to delete.|
- Example - Example
```js ```js
...@@ -864,15 +864,15 @@ Asynchronously writes data into a file. This method uses a promise to return the ...@@ -864,15 +864,15 @@ Asynchronously writes data into a file. This method uses a promise to return the
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ------------------------------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the file to write.| | fd | number | Yes | File descriptor of the file to write. |
| buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes| Data to write. It can be a string or data from a buffer.| | buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes | Data to write. It can be a string or data from a buffer. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**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>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | -------- |
| Promise&lt;number&gt; | Length of the data written in the file.| | Promise&lt;number&gt; | Length of the data written in the file.|
- Example - Example
...@@ -900,12 +900,12 @@ Asynchronously writes data into a file. This method uses a callback to return th ...@@ -900,12 +900,12 @@ Asynchronously writes data into a file. This method uses a callback to return th
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the file to write.| | fd | number | Yes | File descriptor of the file to write. |
| buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes| Data to write. It can be a string or data from a buffer.| | buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes | Data to write. It can be a string or data from a buffer. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**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>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked when the data is written asynchronously.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked when the data is written asynchronously. |
- Example - Example
```js ```js
...@@ -932,15 +932,15 @@ Synchronously writes data into a file. ...@@ -932,15 +932,15 @@ Synchronously writes data into a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ------------------------------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the file to write.| | fd | number | Yes | File descriptor of the file to write. |
| buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes| Data to write. It can be a string or data from a buffer.| | buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes | Data to write. It can be a string or data from a buffer. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**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>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------ | -------- |
| number | Length of the data written in the file.| | number | Length of the data written in the file.|
- Example - Example
...@@ -959,14 +959,14 @@ Asynchronously calculates the hash value of a file. This method uses a promise t ...@@ -959,14 +959,14 @@ Asynchronously calculates the hash value of a file. This method uses a promise t
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| algorithm | string | Yes| Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.| | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | -------------------------- |
| Promise&lt;string&gt; | Promise used to return the hash value of the file. The hash value is a hexadecimal string consisting of digits and uppercase letters.| | Promise&lt;string&gt; | Promise used to return the hash value of the file. The hash value is a hexadecimal string consisting of digits and uppercase letters.|
- Example - Example
...@@ -988,11 +988,11 @@ Asynchronously calculates the hash value of a file. This method uses a callback ...@@ -988,11 +988,11 @@ Asynchronously calculates the hash value of a file. This method uses a callback
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | --------------------------- | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| algorithm | string | Yes| Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.| | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.|
- Example - Example
```js ```js
...@@ -1013,14 +1013,14 @@ Asynchronously changes the file permissions based on its path. This method uses ...@@ -1013,14 +1013,14 @@ Asynchronously changes the file permissions based on its path. This method uses
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -1042,11 +1042,11 @@ Asynchronously changes the file permissions based on its path. This method uses ...@@ -1042,11 +1042,11 @@ Asynchronously changes the file permissions based on its path. This method uses
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file permissions are changed asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file permissions are changed asynchronously. |
- Example - Example
```js ```js
...@@ -1065,10 +1065,10 @@ Synchronously changes the file permissions based on its path. ...@@ -1065,10 +1065,10 @@ Synchronously changes the file permissions based on its path.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Example - Example
```js ```js
...@@ -1085,12 +1085,12 @@ Asynchronously obtains file status information based on the file descriptor. Thi ...@@ -1085,12 +1085,12 @@ Asynchronously obtains file status information based on the file descriptor. Thi
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| Promise&lt;[Stat](#stat)&gt; | Promise used to return the file status information obtained.| | Promise&lt;[Stat](#stat)&gt; | Promise used to return the file status information obtained.|
...@@ -1113,10 +1113,10 @@ Asynchronously obtains file status information based on the file descriptor. Thi ...@@ -1113,10 +1113,10 @@ Asynchronously obtains file status information based on the file descriptor. Thi
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------- | ---- | ---------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes| Callback invoked when the file status information is obtained asynchronously.| | callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes | Callback invoked when the file status information is obtained asynchronously.|
- Example - Example
```js ```js
...@@ -1136,13 +1136,13 @@ Synchronously obtains file status information based on the file descriptor. ...@@ -1136,13 +1136,13 @@ Synchronously obtains file status information based on the file descriptor.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------- | ---------- |
| [Stat](#stat) | File status information obtained.| | [Stat](#stat) | File status information obtained.|
- Example - Example
...@@ -1161,14 +1161,14 @@ Asynchronously truncates a file based on the file descriptor. This method uses a ...@@ -1161,14 +1161,14 @@ Asynchronously truncates a file based on the file descriptor. This method uses a
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------- |
| fd | number | Yes| File descriptor of the file to truncate.| | fd | number | Yes | File descriptor of the file to truncate. |
| len | number | Yes| File length, in bytes, after truncation.| | len | number | Yes | File length, in bytes, after truncation.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -1191,11 +1191,11 @@ Asynchronously truncates a file based on the file descriptor. This method uses a ...@@ -1191,11 +1191,11 @@ Asynchronously truncates a file based on the file descriptor. This method uses a
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------- |
| fd | number | Yes| File descriptor of the file to truncate.| | fd | number | Yes | File descriptor of the file to truncate. |
| len | number | Yes| File length, in bytes, after truncation.| | len | number | Yes | File length, in bytes, after truncation.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is truncated asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is truncated asynchronously. |
- Example - Example
```js ```js
...@@ -1214,10 +1214,10 @@ Synchronously truncates a file based on the file descriptor. ...@@ -1214,10 +1214,10 @@ Synchronously truncates a file based on the file descriptor.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------- |
| fd | number | Yes| File descriptor of the file to truncate.| | fd | number | Yes | File descriptor of the file to truncate. |
| len | number | No| File length, in bytes, after truncation.| | len | number | No | File length, in bytes, after truncation.|
- Example - Example
```js ```js
...@@ -1234,14 +1234,14 @@ Asynchronously truncates a file based on its path. This method uses a promise to ...@@ -1234,14 +1234,14 @@ Asynchronously truncates a file based on its path. This method uses a promise to
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------- |
| path | string | Yes| Absolute path of the file to truncate.| | path | string | Yes | Absolute path of the file to truncate. |
| len | number | Yes| File length, in bytes, after truncation.| | len | number | Yes | File length, in bytes, after truncation.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -1263,11 +1263,11 @@ Asynchronously truncates a file based on its path. This method uses a callback t ...@@ -1263,11 +1263,11 @@ Asynchronously truncates a file based on its path. This method uses a callback t
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------- |
| path | string | Yes| Absolute path of the file to truncate.| | path | string | Yes | Absolute path of the file to truncate. |
| len | number | Yes| File length, in bytes, after truncation.| | len | number | Yes | File length, in bytes, after truncation.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is truncated asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is truncated asynchronously. |
- Example - Example
```js ```js
...@@ -1286,10 +1286,10 @@ Synchronously truncates a file based on the file path. ...@@ -1286,10 +1286,10 @@ Synchronously truncates a file based on the file path.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------- |
| path | string | Yes| Absolute path of the file to truncate.| | path | string | Yes | Absolute path of the file to truncate. |
| len | number | No| File length, in bytes, after truncation.| | len | number | No | File length, in bytes, after truncation.|
- Example - Example
```js ```js
...@@ -1310,14 +1310,14 @@ Asynchronously reads the text of a file. This method uses a promise to return th ...@@ -1310,14 +1310,14 @@ Asynchronously reads the text of a file. This method uses a promise to return th
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------ | ---- | ---------------------------------------- |
| filePath | string | Yes| Absolute path of the file to read.| | filePath | string | Yes | Absolute path of the file to read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**encoding** (string): format of the data (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>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**encoding** (string): format of the data (string) to be encoded. The default value is **utf-8**, which is the only value supported.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | ---------- |
| Promise&lt;string&gt; | Promise used to return the content of the file read.| | Promise&lt;string&gt; | Promise used to return the content of the file read.|
- Example - Example
...@@ -1343,11 +1343,11 @@ Asynchronously reads the text of a file. This method uses a callback to return t ...@@ -1343,11 +1343,11 @@ Asynchronously reads the text of a file. This method uses a callback to return t
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------- | ---- | ---------------------------------------- |
| filePath | string | Yes| Absolute path of the file to read.| | filePath | string | Yes | Absolute path of the file to read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**encoding** (string): format of the data (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>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**encoding** (string): format of the data (string) to be encoded. The default value is **utf-8**, which is the only value supported.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked when the file is read asynchronously.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked when the file is read asynchronously. |
- Example - Example
```js ```js
...@@ -1370,15 +1370,15 @@ Synchronously reads the text of a file. ...@@ -1370,15 +1370,15 @@ Synchronously reads the text of a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------ | ---- | ---------------------------------------- |
| filePath | string | Yes| Absolute path of the file to read.| | filePath | string | Yes | Absolute path of the file to read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**encoding** (string): format of the data (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>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**encoding** (string): format of the data (string) to be encoded. The default value is **utf-8**, which is the only value supported.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------ | -------------------- |
| &lt;string&gt;| Content of the file read.| | string | Content of the file read.|
- Example - Example
```js ```js
...@@ -1395,13 +1395,13 @@ Asynchronously obtains link status information. This method uses a promise to re ...@@ -1395,13 +1395,13 @@ Asynchronously obtains link status information. This method uses a promise to re
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------------- |
| path | string | Yes| Absolute path of the target file, pointing to the link status.| | path | string | Yes | Absolute path of the target file, pointing to the link status.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------- | ---------- |
| Promise&lt;[Stat](#stat)&gt; | Promise used to return the link status obtained.| | Promise&lt;[Stat](#stat)&gt; | Promise used to return the link status obtained.|
- Example - Example
...@@ -1423,10 +1423,10 @@ Asynchronously obtains link status information. This method uses a callback to r ...@@ -1423,10 +1423,10 @@ Asynchronously obtains link status information. This method uses a callback to r
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------- | ---- | ----------------- |
| path | string | Yes| Absolute path of the target file, pointing to the link status.| | path | string | Yes | Absolute path of the target file, pointing to the link status.|
| callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes| Callback invoked when the link status information is obtained asynchronously.| | callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes | Callback invoked when the link status information is obtained asynchronously. |
- Example - Example
```js ```js
...@@ -1445,13 +1445,13 @@ Synchronously obtains link status information. ...@@ -1445,13 +1445,13 @@ Synchronously obtains link status information.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------------- |
| path | string | Yes| Absolute path of the target file, pointing to the link status.| | path | string | Yes | Absolute path of the target file, pointing to the link status.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------- | ---------- |
| [Stat](#stat) | Link status obtained.| | [Stat](#stat) | Link status obtained.|
- Example - Example
...@@ -1473,14 +1473,14 @@ Asynchronously reads data from a file. This method uses a promise to return the ...@@ -1473,14 +1473,14 @@ Asynchronously reads data from a file. This method uses a promise to return the
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ----------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes| Buffer used to store the file data read.| | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.| | options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------- | ------ |
| Promise&lt;[ReadOut](#readout)&gt; | Data read.| | Promise&lt;[ReadOut](#readout)&gt; | Data read.|
- Example - Example
...@@ -1506,11 +1506,11 @@ Asynchronously reads data from a file. This method uses a callback to return the ...@@ -1506,11 +1506,11 @@ Asynchronously reads data from a file. This method uses a callback to return the
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes| Buffer used to store the file data read.| | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
| options | Object | No| The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.| | options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.|
| callback | AsyncCallback&lt;[ReadOut](#readout)&gt; | Yes| Callback invoked when the data is read asynchronously from the file.| | callback | AsyncCallback&lt;[ReadOut](#readout)&gt; | Yes | Callback invoked when the data is read asynchronously from the file. |
- Example - Example
```js ```js
...@@ -1532,19 +1532,19 @@ Asynchronously renames a file. This method uses a promise to return the result. ...@@ -1532,19 +1532,19 @@ Asynchronously renames a file. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory| Description |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ------------------------ |
| oldPath | string | Yes| Absolute path of the file to rename.| | oldPath | string | Yes | Absolute path of the file to rename.|
| Newpath | String | Yes| Absolute path of the file renamed.| | newPath | String | Yes | Absolute path of the file renamed. |
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
```js ```js
fileio.rename(oldPath, Newpath).then(function() { fileio.rename(oldPath, newPath).then(function() {
console.info("rename successfully"); console.info("rename successfully");
}).catch(function(err){ }).catch(function(err){
console.info("rename failed with error:"+ err); console.info("rename failed with error:"+ err);
...@@ -1561,15 +1561,15 @@ Asynchronously renames a file. This method uses a callback to return the result. ...@@ -1561,15 +1561,15 @@ Asynchronously renames a file. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ------------- |
| oldpath | string | Yes| Absolute path of the file to rename.| | oldPath | string | Yes | Absolute path of the file to rename. |
| Newpath | String | Yes| Absolute path of the file renamed.| | newPath | String | Yes | Absolute path of the file renamed. |
| Callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is asynchronously renamed.| | Callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is asynchronously renamed.|
- Example - Example
```js ```js
fileio.rename(oldpath, Newpath, function(err){ fileio.rename(oldPath, newPath, function(err){
}); });
``` ```
...@@ -1583,14 +1583,14 @@ Synchronously renames a file. ...@@ -1583,14 +1583,14 @@ Synchronously renames a file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ------------ |
| oldPath | string | Yes| Absolute path of the file to rename.| | oldPath | string | Yes | Absolute path of the file to rename.|
| Newpath | String | Yes| Absolute path of the file renamed.| | newPath | String | Yes | Absolute path of the file renamed. |
- Example - Example
```js ```js
fileio.renameSync(oldpath, newpath); fileio.renameSync(oldPath, newPath);
``` ```
...@@ -1603,13 +1603,13 @@ Asynchronously synchronizes a file. This method uses a promise to return the res ...@@ -1603,13 +1603,13 @@ Asynchronously synchronizes a file. This method uses a promise to return the res
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to synchronize.| | fd | number | Yes | File descriptor of the file to synchronize.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -1631,10 +1631,10 @@ Asynchronously synchronizes a file. This method uses a callback to return the re ...@@ -1631,10 +1631,10 @@ Asynchronously synchronizes a file. This method uses a callback to return the re
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | --------------- |
| fd | number | Yes| File descriptor of the file to synchronize.| | fd | number | Yes | File descriptor of the file to synchronize. |
| Callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file is synchronized in asynchronous mode.| | Callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is synchronized in asynchronous mode.|
- Example - Example
```js ```js
...@@ -1653,9 +1653,9 @@ Synchronizes a file in synchronous mode. ...@@ -1653,9 +1653,9 @@ Synchronizes a file in synchronous mode.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to synchronize.| | fd | number | Yes | File descriptor of the file to synchronize.|
- Example - Example
```js ```js
...@@ -1672,13 +1672,13 @@ Asynchronously synchronizes data in a file. This method uses a promise to return ...@@ -1672,13 +1672,13 @@ Asynchronously synchronizes data in a file. This method uses a promise to return
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to synchronize.| | fd | number | Yes | File descriptor of the file to synchronize.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.|
- Example - Example
...@@ -1700,10 +1700,10 @@ Asynchronously synchronizes data in a file. This method uses a callback to retur ...@@ -1700,10 +1700,10 @@ Asynchronously synchronizes data in a file. This method uses a callback to retur
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------------- | ---- | ----------------- |
| fd | number | Yes| File descriptor of the file to synchronize.| | fd | number | Yes | File descriptor of the file to synchronize. |
| callback | AsyncCallback&nbsp;&lt;void&gt; | Yes| Callback invoked when the file data is synchronized in asynchronous mode.| | callback | AsyncCallback&nbsp;&lt;void&gt; | Yes | Callback invoked when the file data is synchronized in asynchronous mode.|
- Example - Example
```js ```js
...@@ -1722,9 +1722,9 @@ Synchronizes data in a file in synchronous mode. ...@@ -1722,9 +1722,9 @@ Synchronizes data in a file in synchronous mode.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the file to synchronize.| | fd | number | Yes | File descriptor of the file to synchronize.|
- Example - Example
```js ```js
...@@ -1741,14 +1741,14 @@ Asynchronously creates a symbolic link based on a path. This method uses a promi ...@@ -1741,14 +1741,14 @@ Asynchronously creates a symbolic link based on a path. This method uses a promi
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ------------ |
| target | string | Yes| Absolute path of the symbolic link.| | target | string | Yes | Absolute path of the symbolic link. |
| srcPath | string | Yes| Absolute path of the referenced file or directory contained in the symbolic link.| | srcPath | string | Yes | Absolute path of the referenced file or directory contained in the symbolic link.|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.|
- Example - Example
...@@ -1770,11 +1770,11 @@ Asynchronously creates a symbolic link based on a path. This method uses a callb ...@@ -1770,11 +1770,11 @@ Asynchronously creates a symbolic link based on a path. This method uses a callb
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------- |
| target | string | Yes| Absolute path of the symbolic link.| | target | string | Yes | Absolute path of the symbolic link. |
| srcPath | string | Yes| Absolute path of the referenced file or directory contained in the symbolic link.| | srcPath | string | Yes | Absolute path of the referenced file or directory contained in the symbolic link. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the symbolic link is created asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the symbolic link is created asynchronously.|
- Example - Example
```js ```js
...@@ -1793,10 +1793,10 @@ Synchronously creates a symbolic link based on a specified path. ...@@ -1793,10 +1793,10 @@ Synchronously creates a symbolic link based on a specified path.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ------------ |
| target | string | Yes| Absolute path of the symbolic link.| | target | string | Yes | Absolute path of the symbolic link. |
| srcPath | string | Yes| Absolute path of the referenced file or directory contained in the symbolic link.| | srcPath | string | Yes | Absolute path of the referenced file or directory contained in the symbolic link.|
- Example - Example
```js ```js
...@@ -1813,15 +1813,15 @@ Asynchronously changes the file owner based on its path. This method uses a prom ...@@ -1813,15 +1813,15 @@ Asynchronously changes the file owner based on its path. This method uses a prom
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | --------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| uid | number | Yes| New user ID (UID).| | uid | number | Yes | New user ID (UID). |
| gid | number | Yes| New group ID (GID).| | gid | number | Yes | New group ID (GID).|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.|
- Example - Example
...@@ -1844,12 +1844,12 @@ Asynchronously changes the file owner based on its path. This method uses a call ...@@ -1844,12 +1844,12 @@ Asynchronously changes the file owner based on its path. This method uses a call
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | --------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file owner is changed asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file owner is changed asynchronously.|
- Example - Example
```js ```js
...@@ -1869,11 +1869,11 @@ Synchronously changes the file owner based on its path. ...@@ -1869,11 +1869,11 @@ Synchronously changes the file owner based on its path.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file.|
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
- Example - Example
```js ```js
...@@ -1891,13 +1891,13 @@ Asynchronously creates a temporary directory. This method uses a promise to retu ...@@ -1891,13 +1891,13 @@ Asynchronously creates a temporary directory. This method uses a promise to retu
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------ | ------ | ---- | --------------------------- |
| prefix | string | Yes| A randomly generated string used to replace "XXXXXX" in a directory.| | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | --------------------- | ---------- |
| Promise&lt;string&gt; | Unique path generated.| | Promise&lt;string&gt; | Unique path generated.|
- Example - Example
...@@ -1919,10 +1919,10 @@ Asynchronously creates a temporary directory. This method uses a callback to ret ...@@ -1919,10 +1919,10 @@ Asynchronously creates a temporary directory. This method uses a callback to ret
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------- | ---- | --------------------------- |
| prefix | string | Yes| A randomly generated string used to replace "XXXXXX" in a directory.| | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked when a temporary directory is created asynchronously.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked when a temporary directory is created asynchronously. |
- Example - Example
```js ```js
...@@ -1941,13 +1941,13 @@ Synchronously creates a temporary directory. ...@@ -1941,13 +1941,13 @@ Synchronously creates a temporary directory.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------ | ------ | ---- | --------------------------- |
| prefix | string | Yes| A randomly generated string used to replace "XXXXXX" in a directory.| | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | ------ | ---------- |
| string | Unique path generated.| | string | Unique path generated.|
- Example - Example
...@@ -1965,14 +1965,14 @@ Asynchronously changes the file permissions based on the file descriptor. This m ...@@ -1965,14 +1965,14 @@ Asynchronously changes the file permissions based on the file descriptor. This m
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result asynchronously. An empty value is returned.|
- Example - Example
...@@ -1994,11 +1994,11 @@ Asynchronously changes the file permissions based on the file descriptor. This m ...@@ -1994,11 +1994,11 @@ Asynchronously changes the file permissions based on the file descriptor. This m
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
| callback | AsyncCallback&nbsp;&lt;void&gt; | Yes| Callback invoked when the file permissions are changed asynchronously.| | callback | AsyncCallback&nbsp;&lt;void&gt; | Yes | Callback invoked when the file permissions are changed asynchronously. |
- Example - Example
```js ```js
...@@ -2017,10 +2017,10 @@ Synchronously changes the file permissions based on the file descriptor. ...@@ -2017,10 +2017,10 @@ Synchronously changes the file permissions based on the file descriptor.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| mode | number | Yes| Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.| | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<br>-&nbsp;**0o700**: The owner has the read, write, and execute permissions.<br>- &nbsp;**0o400**: The owner has the read permission.<br>-&nbsp;**0o200**: The owner has the write permission.<br>-&nbsp;**0o100**: The owner has the execute permission.<br>-&nbsp;**0o070**: The user group has the read, write, and execute permissions.<br>-&nbsp;**0o040**: The user group has the read permission.<br>-&nbsp;**0o020**: The user group has the write permission.<br>-&nbsp;**0o010**: The user group has the execute permission.<br>-&nbsp;**0o007**: Other users have the read, write, and execute permissions.<br>-&nbsp;**0o004**: Other users have the read permission.<br>-&nbsp;**0o002**: Other users have the write permission.<br>-&nbsp;**0o001**: Other users have the execute permission.|
- Example - Example
```js ```js
...@@ -2037,14 +2037,14 @@ Asynchronously opens a stream based on the file path. This method uses a promise ...@@ -2037,14 +2037,14 @@ Asynchronously opens a stream based on the file path. This method uses a promise
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | string | Yes| -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------------------- | --------- |
| Promise&lt;[Stream](#stream7)&gt; | Promise used to return the result.| | Promise&lt;[Stream](#stream7)&gt; | Promise used to return the result.|
- Example - Example
...@@ -2066,11 +2066,11 @@ Asynchronously opens a stream based on the file path. This method uses a callbac ...@@ -2066,11 +2066,11 @@ Asynchronously opens a stream based on the file path. This method uses a callbac
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------------------- | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | string | Yes| -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
| callback | AsyncCallback&lt;[Stream](#stream7)&gt; | Yes| Callback invoked when the stream is open asynchronously.| | callback | AsyncCallback&lt;[Stream](#stream7)&gt; | Yes | Callback invoked when the stream is open asynchronously. |
- Example - Example
```js ```js
...@@ -2089,14 +2089,14 @@ Synchronously opens a stream based on the file path. ...@@ -2089,14 +2089,14 @@ Synchronously opens a stream based on the file path.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| mode | string | Yes| -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | ------------------ | --------- |
| [Stream](#stream7) | Stream opened.| | [Stream](#stream7) | Stream opened.|
- Example - Example
...@@ -2114,14 +2114,14 @@ Asynchronously opens a stream based on the file descriptor. This method uses a p ...@@ -2114,14 +2114,14 @@ Asynchronously opens a stream based on the file descriptor. This method uses a p
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| mode | string | Yes| -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | --------------------------------- | --------- |
| Promise&lt;[Stream](#stream7)&gt; | Promise used to return the result.| | Promise&lt;[Stream](#stream7)&gt; | Promise used to return the result.|
- Example - Example
...@@ -2143,11 +2143,11 @@ Asynchronously opens a stream based on the file descriptor. This method uses a c ...@@ -2143,11 +2143,11 @@ Asynchronously opens a stream based on the file descriptor. This method uses a c
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| mode | string | Yes| -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
| callback | AsyncCallback&nbsp;&lt;[Stream](#stream7)&gt; | Yes| Callback invoked when the stream is open asynchronously.| | callback | AsyncCallback&nbsp;&lt;[Stream](#stream7)&gt; | Yes | Callback invoked when the stream is open asynchronously. |
- Example - Example
```js ```js
...@@ -2166,14 +2166,14 @@ Synchronously opens a stream based on the file descriptor. ...@@ -2166,14 +2166,14 @@ Synchronously opens a stream based on the file descriptor.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ---------------------------------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| mode | string | Yes| -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| | mode | string | Yes | -&nbsp;**r**: Open a file for reading. The file must exist.<br>-&nbsp;**r+**: Open a file for both reading and writing. The file must exist.<br>-&nbsp;**w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>-&nbsp;**a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>-&nbsp;**a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | ------------------ | --------- |
| [Stream](#stream7) | Stream opened.| | [Stream](#stream7) | Stream opened.|
- Example - Example
...@@ -2191,15 +2191,15 @@ Asynchronously changes the file owner based on the file descriptor. This method ...@@ -2191,15 +2191,15 @@ Asynchronously changes the file owner based on the file descriptor. This method
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file.|
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -2222,12 +2222,12 @@ Asynchronously changes the file owner based on the file descriptor. This method ...@@ -2222,12 +2222,12 @@ Asynchronously changes the file owner based on the file descriptor. This method
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | --------------- |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file. |
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file owner is changed asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file owner is changed asynchronously.|
- Example - Example
```js ```js
...@@ -2247,11 +2247,11 @@ Synchronously changes the file owner based on the file descriptor. ...@@ -2247,11 +2247,11 @@ Synchronously changes the file owner based on the file descriptor.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ------------ |
| fd | number | Yes| File descriptor of the target file.| | fd | number | Yes | File descriptor of the target file.|
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
- Example - Example
```js ```js
...@@ -2269,15 +2269,15 @@ Asynchronously changes the file owner based on the file path, changes the owner ...@@ -2269,15 +2269,15 @@ Asynchronously changes the file owner based on the file path, changes the owner
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file.|
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.| | Promise&lt;void&gt; | Promise used to return the result. An empty value is returned.|
- Example - Example
...@@ -2300,12 +2300,12 @@ Asynchronously changes the file owner based on the file path, changes the owner ...@@ -2300,12 +2300,12 @@ Asynchronously changes the file owner based on the file path, changes the owner
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | --------------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file. |
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the file owner is changed asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file owner is changed asynchronously.|
- Example - Example
```js ```js
...@@ -2325,11 +2325,11 @@ Synchronously changes the file owner based on the file path and changes the owne ...@@ -2325,11 +2325,11 @@ Synchronously changes the file owner based on the file path and changes the owne
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Absolute path of the target file.| | path | string | Yes | Absolute path of the target file.|
| uid | number | Yes| New UID.| | uid | number | Yes | New UID. |
| gid | number | Yes| New GID.| | gid | number | Yes | New GID. |
- Example - Example
```js ```js
...@@ -2347,15 +2347,15 @@ Asynchronously listens for the changes of a file or directory. This method uses ...@@ -2347,15 +2347,15 @@ Asynchronously listens for the changes of a file or directory. This method uses
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------------- | ---- | ---------------------------------------- |
| filename | string | Yes| Absolute path of the target file.| | filename | string | Yes | Absolute path of the target file. |
| events | Number | Yes| -&nbsp;**1**: The file or directory is renamed.<br>-&nbsp;**2**: The file or directory is modified.<br>-&nbsp;**3**: The file or directory is modified and renamed.| | events | Number | Yes | -&nbsp;**1**: The file or directory is renamed.<br>-&nbsp;**2**: The file or directory is modified.<br>-&nbsp;**3**: The file or directory is modified and renamed.|
| callback | AsyncCallback&lt;number&nbsp;&gt; | Yes| Called each time a change is detected.| | callback | AsyncCallback&lt;number&nbsp;&gt; | Yes | Called each time a change is detected. |
- Return value - Return value
| Name| Description| | Name | Description |
| -------- | -------- | | -------------------- | ---------- |
| [Watcher](#watcher7) | Instance for listening for a file change event.| | [Watcher](#watcher7) | Instance for listening for a file change event.|
- Example - Example
...@@ -2372,11 +2372,11 @@ Obtains the file read result. This class applies only to the **read()** method. ...@@ -2372,11 +2372,11 @@ Obtains the file read result. This class applies only to the **read()** method.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | --------- | ---------- | ---- | ---- | ----------------- |
| bytesRead | number | Yes| Yes| Length of the data read.| | bytesRead | number | Yes | Yes | Length of the data read. |
| offset | number | Yes| Yes| Position of the buffer to which the data will be read in reference to the start address of the buffer.| | offset | number | Yes | Yes | Position of the buffer to which the data will be read in reference to the start address of the buffer.|
| buffer | ArrayBufer | Yes| Yes| Buffer for storing the data read.| | buffer | ArrayBufer | Yes | Yes | Buffer for storing the data read. |
## Stat ## Stat
...@@ -2387,20 +2387,20 @@ Provides detailed file information. Before calling a method of the **Stat** clas ...@@ -2387,20 +2387,20 @@ Provides detailed file information. Before calling a method of the **Stat** clas
### Attributes ### Attributes
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | ------ | ------ | ---- | ---- | ---------------------------------------- |
| dev | number | Yes| No| Major device number.| | dev | number | Yes | No | Major device number. |
| ino | number | Yes| No| File ID. Different files on the same device have different **ino**s.| | ino | number | Yes | No | File ID. Different files on the same device have different **ino**s. |
| mode | number | Yes| No| File type and permissions. The first four bits indicate the file type, and the last 12 bits indicate the permissions. The bit fields are described as follows:<br>-&nbsp;**0o170000**: mask used to obtain the file type.<br>-&nbsp;**0o140000**: The file is a socket.<br>-&nbsp;**0o120000**: The file is a symbolic link.<br>-&nbsp;**0o100000**: The file is a regular file.<br>-&nbsp;**0o060000**: The file is a block device.<br>-&nbsp;**0o040000**: The file is a directory.<br>-&nbsp;**0o020000**: The file is a character device.<br>-&nbsp;**0o010000**: The file is a named pipe (FIFO).<br>-&nbsp;**0o0700**: mask used to obtain the owner permissions.<br>-&nbsp;**0o0400**: The owner has the permission to read a regular file or a directory entry.<br>-&nbsp;**0o0200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>-&nbsp;**0o0100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>-&nbsp;**0o0070**: mask used to obtain the user group permissions.<br>-&nbsp;**0o0040**: The user group has the permission to read a regular file or a directory entry.<br>-&nbsp;**0o0020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>-&nbsp;**0o0010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>-&nbsp;**0o0007**: mask used to obtain the permissions of other users.<br>-&nbsp;**0o0004**: Other users have the permission to read a regular file or a directory entry.<br>-&nbsp;**0o0002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>-&nbsp;**0o0001**: Other users have the permission to execute a regular file or search for the specified path in a directory.| | mode | number | Yes | No | File type and permissions. The first four bits indicate the file type, and the last 12 bits indicate the permissions. The bit fields are described as follows:<br>-&nbsp;**0o170000**: mask used to obtain the file type.<br>-&nbsp;**0o140000**: The file is a socket.<br>-&nbsp;**0o120000**: The file is a symbolic link.<br>-&nbsp;**0o100000**: The file is a regular file.<br>-&nbsp;**0o060000**: The file is a block device.<br>-&nbsp;**0o040000**: The file is a directory.<br>-&nbsp;**0o020000**: The file is a character device.<br>-&nbsp;**0o010000**: The file is a named pipe (FIFO).<br>-&nbsp;**0o0700**: mask used to obtain the owner permissions.<br>-&nbsp;**0o0400**: The owner has the permission to read a regular file or a directory entry.<br>-&nbsp;**0o0200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>-&nbsp;**0o0100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>-&nbsp;**0o0070**: mask used to obtain the user group permissions.<br>-&nbsp;**0o0040**: The user group has the permission to read a regular file or a directory entry.<br>-&nbsp;**0o0020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>-&nbsp;**0o0010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>-&nbsp;**0o0007**: mask used to obtain the permissions of other users.<br>-&nbsp;**0o0004**: Other users have the permission to read a regular file or a directory entry.<br>-&nbsp;**0o0002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>-&nbsp;**0o0001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| nlink | number | Yes| No| Number of hard links in the file.| | nlink | number | Yes | No | Number of hard links in the file. |
| uid | number | Yes| No| User ID, that is ID of the file owner.| | uid | number | Yes | No | User ID, that is ID of the file owner. |
| gid | number | Yes| No| Group ID, that is, ID of the user group of the file.| | gid | number | Yes | No | Group ID, that is, ID of the user group of the file. |
| rdev | number | Yes| No| Minor device number.| | rdev | number | Yes | No | Minor device number. |
| size | number | Yes| No| File size, in bytes. This parameter is valid only for regular files.| | size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. |
| blocks | number | Yes| No| Number of blocks occupied by a file. Each block is 512 bytes.| | blocks | number | Yes | No | Number of blocks occupied by a file. Each block is 512 bytes. |
| atime | number | Yes| No| Time of the last access to the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970.| | atime | number | Yes | No | Time of the last access to the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970. |
| mtime | number | Yes| No| Time of the last modification to the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970.| | mtime | number | Yes | No | Time of the last modification to the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970. |
| ctime | number | Yes| No| Time of the last status change of the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970.| | ctime | number | Yes | No | Time of the last status change of the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970. |
### isBlockDevice ### isBlockDevice
...@@ -2412,8 +2412,8 @@ Checks whether the current directory entry is a block special file. A block spec ...@@ -2412,8 +2412,8 @@ Checks whether the current directory entry is a block special file. A block spec
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | ---------------- |
| boolean | Whether the directory entry is a block special file.| | boolean | Whether the directory entry is a block special file.|
- Example - Example
...@@ -2431,8 +2431,8 @@ Checks whether the current directory entry is a character special file. A charac ...@@ -2431,8 +2431,8 @@ Checks whether the current directory entry is a character special file. A charac
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | ----------------- |
| boolean | Whether the directory entry is a character special file.| | boolean | Whether the directory entry is a character special file.|
- Example - Example
...@@ -2450,8 +2450,8 @@ Checks whether a directory entry is a directory. ...@@ -2450,8 +2450,8 @@ Checks whether a directory entry is a directory.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | ------------- |
| boolean | Whether the directory entry is a directory.| | boolean | Whether the directory entry is a directory.|
- Example - Example
...@@ -2469,8 +2469,8 @@ Checks whether the current directory entry is a named pipe (or FIFO). Named pipe ...@@ -2469,8 +2469,8 @@ Checks whether the current directory entry is a named pipe (or FIFO). Named pipe
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | --------------------- |
| boolean | Whether the directory entry is a FIFO.| | boolean | Whether the directory entry is a FIFO.|
- Example - Example
...@@ -2488,8 +2488,8 @@ Checks whether a directory entry is a regular file. ...@@ -2488,8 +2488,8 @@ Checks whether a directory entry is a regular file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | --------------- |
| boolean | Whether the directory entry is a regular file.| | boolean | Whether the directory entry is a regular file.|
- Example - Example
...@@ -2507,8 +2507,8 @@ Checks whether a directory entry is a socket. ...@@ -2507,8 +2507,8 @@ Checks whether a directory entry is a socket.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | -------------- |
| boolean | Whether the directory entry is a socket.| | boolean | Whether the directory entry is a socket.|
- Example - Example
...@@ -2526,8 +2526,8 @@ Checks whether a directory entry is a symbolic link. ...@@ -2526,8 +2526,8 @@ Checks whether a directory entry is a symbolic link.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type| Description| | Type | Description |
| -------- | -------- | | ------- | --------------- |
| boolean | Whether the directory entry is a symbolic link.| | boolean | Whether the directory entry is a symbolic link.|
- Example - Example
...@@ -2564,9 +2564,9 @@ Asynchronously stops **watcher**. This method uses a callback to return the resu ...@@ -2564,9 +2564,9 @@ Asynchronously stops **watcher**. This method uses a callback to return the resu
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ---------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when **watcher** is stopped asynchronously.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when **watcher** is stopped asynchronously.|
- Example - Example
```js ```js
...@@ -2574,3 +2574,564 @@ Asynchronously stops **watcher**. This method uses a callback to return the resu ...@@ -2574,3 +2574,564 @@ Asynchronously stops **watcher**. This method uses a callback to return the resu
// Do something. // Do something.
}); });
``` ```
## Stream<sup>7+</sup>
File stream. Before calling a method of the **Stream** class, use the **createStream()** method synchronously or asynchronously to create a **Stream** instance.
### close<sup>7+</sup>
close(): Promise&lt;void&gt;
Asynchronously closes the stream. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the stream close result.|
- Example
```js
let ss= fileio.createStreamSync(path);
ss.close().then(function(){
console.info("close fileStream successfully");
}).catch(function(err){
console.info("close fileStream failed with error:"+ err);
});
```
### close<sup>7+</sup>
close(callback: AsyncCallback&lt;void&gt;): void
Asynchronously closes the stream. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the stream is closed asynchronously.|
- Example
```js
let ss= fileio.createStreamSync(path);
ss.close(function (err) {
// do something
});
```
### closeSync
closeSync(): void
Synchronously closes the stream.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Example
```js
let ss= fileio.createStreamSync(path);
ss.closeSync();
```
### flush<sup>7+</sup>
flush(): Promise&lt;void&gt;
Asynchronously flushes the stream. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the stream flushing result.|
- Example
```js
let ss= fileio.createStreamSync(path);
ss.flush().then(function (){
console.info("flush successfully");
}).catch(function(err){
console.info("flush failed with error:"+ err);
});
```
### flush<sup>7+</sup>
flush(callback: AsyncCallback&lt;void&gt;): void
Asynchronously flushes the stream. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the stream is asynchronously flushed.|
- Example
```js
let ss= fileio.createStreamSync(path);
ss.flush(function (err) {
// do something
});
```
### flushSync<sup>7+</sup>
flushSync(): void
Synchronously flushes the stream.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Example
```js
let ss= fileio.createStreamSync(path);
ss.flushSync();
```
### write<sup>7+</sup>
write(buffer: ArrayBuffer | string, options?: {
offset?: number;
length?: number;
position?: number;
encoding?: string;
}): Promise&lt;number&gt;
Asynchronously writes data into the stream. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes | Data to write. It can be a string or data from a buffer. |
| options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.|
- Return value
| Type | Description |
| --------------------- | -------- |
| Promise&lt;number&gt; | Length of the data written in the file.|
- Example
```js
let ss= fileio.createStreamSync(fpath, "r+");
ss.write("hello, world",{offset: 1,length: 5,position: 5,encoding :'utf-8'}).then(function (number){
console.info("write successfully:"+ number);
}).catch(function(err){
console.info("write failed with error:"+ err);
});
```
### write<sup>7+</sup>
write(buffer: ArrayBuffer | string, options: {
offset?: number;
length?: number;
position?: number;
encoding?: string;
}, callback: AsyncCallback&lt;number&gt;): void
Asynchronously writes data into the stream. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| -------- | ------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes | Data to write. It can be a string or data from a buffer. |
| options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked when the data is written asynchronously. |
- Example
```js
let ss= fileio.createStreamSync(fpath, "r+");
ss.write("hello, world", {offset: 1, length: 5, position: 5, encoding :'utf-8'}, function (err, bytesWritten) {
if (!err) {
// do something
console.log(bytesWritten);
}
});
```
### writeSync<sup>7+</sup>
writeSync(buffer: ArrayBuffer | string, options?: {
offset?: number;
length?: number;
position?: number;
encoding?: string;
}): number
Synchronously writes data into the stream.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;string | Yes | Data to write. It can be a string or data from a buffer. |
| options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): start position to write the data in the file. By default, data is written from the current position.<br>-&nbsp;**encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.|
- Return value
| Type | Description |
| ------ | -------- |
| number | Length of the data written in the file.|
- Example
```js
let ss= fileio.createStreamSync(fpath,"r+");
let num = ss.writeSync("hello, world", {offset: 1, length: 5, position: 5, encoding :'utf-8'});
```
### read<sup>7+</sup>
read(buffer: ArrayBuffer, options?: {
position?: number;
offset?: number;
length?: number;
}): Promise&lt;ReadOut&gt;
Asynchronously reads data from the stream. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| ------- | ----------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
| options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.|
- Return value
| Type | Description |
| ---------------------------------- | ------ |
| Promise&lt;[ReadOut](#readout)&gt; | Data read.|
- Example
```js
let ss = fileio.createStreamSync(fpath, "r+");
ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readout){
console.info("read data successfully");
}).catch(function(err){
console.info("read data failed with error:"+ err);
});
```
### read<sup>7+</sup>
read(buffer: ArrayBuffer, options: {
position?: number;
offset?: number;
length?: number;
}, callback: AsyncCallback&lt;ReadOut&gt;): void
Asynchronously reads data from the stream. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
| options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.|
| callback | AsyncCallback&lt;[ReadOut](#readout)&gt; | Yes | Callback invoked when data is read asynchronously from the stream. |
- Example
```js
let ss = fileio.createStreamSync(fpath, "r+");
ss.read(new ArrayBuffer(4096),{offset: 1, length: 5, position: 5},function (err, readOut) {
if (!err) {
// do something
}
});
```
### readSync<sup>7+</sup>
readSync(buffer: ArrayBuffer, options?: {
position?: number;
offset?: number;
length?: number;
}): number
Synchronously reads data from the stream.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| ------- | ----------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
| options | Object | No | The options are as follows:<br>-&nbsp;**offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.<br>-&nbsp;**length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>-&nbsp;**position** (number): position of the data to read in the file. By default, data is read from the current position.|
- Return value
| Type | Description |
| ------ | -------- |
| number | Length of the data read.|
- Example
```js
let ss = fileio.createStreamSync(fpath, "r+");
let num = ss.readSync(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5});
```
## Dir
Manages directories. Before calling a method of the **Dir** class, use the [opendir()](#fileioopendir) method synchronously or asynchronously to create a **Dir** instance.
### read
read(): Promise&lt;Dirent&gt;
Asynchronously reads the next directory entry. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| -------------------------------- | ------------- |
| Promise&lt;[Dirent](#dirent)&gt; | Directory entry that is read asynchronously.|
- Example
```js
let dir = fileio.opendirSync(path);
dir.read().then(function (dirent){
console.info("read successfully:"+ dirent.name);
}).catch(function(err){
console.info("read failed with error:"+ err);
});
```
### read
read(callback: AsyncCallback&lt;Dirent&gt;): void
Asynchronously reads the next directory entry. This method uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | ---- | ---------------- |
| callback | AsyncCallback&lt;[Dirent](#dirent)&gt; | Yes | Callback invoked when the next directory entry is asynchronously read.|
- Example
```js
let dir = fileio.opendirSync(path);
dir.read(function (err, dirent) {
if (!err) {
// do something
console.log(dirent.name)
}
});
```
### readSync
readSync(): Dirent
Synchronously reads the next directory entry.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ----------------- | -------- |
| [Dirent](#dirent) | Directory entry read.|
- Example
```js
let dir = fileio.opendirSync(path);
let dirent = dir.readSync();
```
### closeSync
closeSync(): void
Closes a directory. After a directory is closed, the file descriptor in Dir will be released and no directory entry can be read from Dir.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Example
```js
let dir = fileio.opendirSync(path);
dir.closeSync();
```
## Dirent
Provides information about files and directories. Before calling a method of the **Dirent** class, use the [dir.read()](#read) method synchronously or asynchronously to create a **Dirent** instance.
**System capability**: SystemCapability.FileManagement.File.FileIO
### Attributes
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ------- |
| name | string | Yes | No | Directory entry name.|
### isBlockDevice
isBlockDevice(): boolean
Checks whether the current directory entry is a block special file. A block special file supports access by block only, and it is cached when accessed.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | ---------------- |
| boolean | Whether the directory entry is a block special file.|
- Example
```js
let dir = fileio.opendirSync(path);
let isBLockDevice = dir.readSync().isBlockDevice();
```
### isCharacterDevice
isCharacterDevice(): boolean
Checks whether a directory entry is a character special file. A character special file supports random access, and it is not cached when accessed.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | ----------------- |
| boolean | Whether the directory entry is a character special file.|
- Example
```js
let dir = fileio.opendirSync(path);
let isCharacterDevice = dir.readSync().isCharacterDevice();
```
### isDirectory
isDirectory(): boolean
Checks whether a directory entry is a directory.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | ------------- |
| boolean | Whether the directory entry is a directory.|
- Example
```js
let dir = fileio.opendirSync(path);
let isDirectory = dir.readSync().isDirectory();
```
### isFIFO
isFIFO(): boolean
Checks whether the current directory entry is a named pipe (or FIFO). Named pipes are used for inter-process communication.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | --------------- |
| boolean | Whether the directory entry is a FIFO.|
- Example
```js
let dir = fileio.opendirSync(path);
let isFIFO = dir.readSync().isFIFO();
```
### isFile
isFile(): boolean
Checks whether a directory entry is a regular file.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | --------------- |
| boolean | Whether the directory entry is a regular file.|
- Example
```js
let dir = fileio.opendirSync(path);
let isFile = dir.readSync().isFile();
```
### isSocket
isSocket(): boolean
Checks whether a directory entry is a socket.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | -------------- |
| boolean | Whether the directory entry is a socket.|
- Example
```js
let dir = fileio.opendirSync(dpath);
let isSocket = dir.readSync().isSocket();
```
### isSymbolicLink
isSymbolicLink(): boolean
Checks whether a directory entry is a symbolic link.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Return value
| Type | Description |
| ------- | --------------- |
| boolean | Whether the directory entry is a symbolic link.|
- Example
```js
let dir = fileio.opendirSync(path);
let isSymbolicLink = dir.readSync().isSymbolicLink();
```
# Resource Management #Resource Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -19,9 +19,9 @@ Obtains the **ResourceManager** object of this application. This method uses a c ...@@ -19,9 +19,9 @@ Obtains the **ResourceManager** object of this application. This method uses a c
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ----------------------------- |
| callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the **ResourceManager** object obtained. | | callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the **ResourceManager** object obtained.|
**Example** **Example**
``` ```
...@@ -50,10 +50,10 @@ Obtains the **ResourceManager** object of an application. This method uses an as ...@@ -50,10 +50,10 @@ Obtains the **ResourceManager** object of an application. This method uses an as
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ---------------------------------------- | --------- | ---------------------------------------- | | ---------- | ---------------------------------------- | ---- | ----------------------------- |
| bundleName | string | Yes | Bundle name of the target application. | | bundleName | string | Yes | Bundle name of the target application. |
| callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the **ResourceManager** object obtained. | | callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the **ResourceManager** object obtained.|
**Example** **Example**
``` ```
...@@ -71,9 +71,9 @@ Obtains the **ResourceManager** object of this application. This method uses a p ...@@ -71,9 +71,9 @@ Obtains the **ResourceManager** object of this application. This method uses a p
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ----------------- |
| Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained. | | Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained.|
**Example** **Example**
``` ```
...@@ -100,14 +100,14 @@ Obtains the **ResourceManager** object of an application. This method uses a pro ...@@ -100,14 +100,14 @@ Obtains the **ResourceManager** object of an application. This method uses a pro
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ------ | --------- | -------------------------------------- | | ---------- | ------ | ---- | ------------- |
| bundleName | string | Yes | Bundle name of the target application. | | bundleName | string | Yes | Bundle name of the target application.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ------------------ |
| Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained. | | Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained.|
**Example** **Example**
``` ```
...@@ -125,10 +125,10 @@ Enumerates the screen directions. ...@@ -125,10 +125,10 @@ Enumerates the screen directions.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name | Default Value | Description | | Name | Default Value | Description |
| -------------------- | ------------- | ----------- | | -------------------- | ---- | ---- |
| DIRECTION_VERTICAL | 0 | Portrait | | DIRECTION_VERTICAL | 0 | Portrait |
| DIRECTION_HORIZONTAL | 1 | Landscape | | DIRECTION_HORIZONTAL | 1 | Landscape |
## DeviceType ## DeviceType
...@@ -137,14 +137,14 @@ Enumerates the device types. ...@@ -137,14 +137,14 @@ Enumerates the device types.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name | Default Value | Description | | Name | Default Value | Description |
| -------------------- | ------------- | ------------- | | -------------------- | ---- | ---- |
| DEVICE_TYPE_PHONE | 0x00 | Mobile phone. | | DEVICE_TYPE_PHONE | 0x00 | Mobile phone. |
| DEVICE_TYPE_TABLET | 0x01 | Tablet. | | DEVICE_TYPE_TABLET | 0x01 | Tablet. |
| DEVICE_TYPE_CAR | 0x02 | Automobile. | | DEVICE_TYPE_CAR | 0x02 | Automobile. |
| DEVICE_TYPE_PC | 0x03 | Computer. | | DEVICE_TYPE_PC | 0x03 | Computer. |
| DEVICE_TYPE_TV | 0x04 | TV. | | DEVICE_TYPE_TV | 0x04 | TV. |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. | | DEVICE_TYPE_WEARABLE | 0x06 | Wearable. |
## ScreenDensity ## ScreenDensity
...@@ -153,14 +153,14 @@ Enumerates the screen density types. ...@@ -153,14 +153,14 @@ Enumerates the screen density types.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name | Default Value | Description | | Name | Default Value | Description |
| -------------- | ------------- | ---------------------------------------- | | -------------- | ---- | ---------- |
| SCREEN_SDPI | 120 | Screen density with small-scale dots per inch (SDPI). | | SCREEN_SDPI | 120 | Screen density with small-scale dots per inch (SDPI). |
| SCREEN_MDPI | 160 | Screen density with medium-scale dots per inch (MDPI). | | SCREEN_MDPI | 160 | Screen density with medium-scale dots per inch (MDPI). |
| SCREEN_LDPI | 240 | Screen density with large-scale dots per inch (LDPI). | | SCREEN_LDPI | 240 | Screen density with large-scale dots per inch (LDPI). |
| SCREEN_XLDPI | 320 | Screen density with extra-large-scale dots per inch (XLDPI). | | SCREEN_XLDPI | 320 | Screen density with extra-large-scale dots per inch (XLDPI). |
| SCREEN_XXLDPI | 480 | Screen density with extra-extra-large-scale dots per inch (XXLDPI). | | SCREEN_XXLDPI | 480 | Screen density with extra-extra-large-scale dots per inch (XXLDPI). |
| SCREEN_XXXLDPI | 640 | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI). | | SCREEN_XXXLDPI | 640 | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI).|
## Configuration ## Configuration
...@@ -170,10 +170,10 @@ Defines the device configuration. ...@@ -170,10 +170,10 @@ Defines the device configuration.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| --------- | ----------------------- | -------- | -------- | ------------------------------- | | --------- | ----------------------- | ---- | ---- | -------- |
| direction | [Direction](#direction) | Yes | No | Screen direction of the device. | | direction | [Direction](#direction) | Yes | No | Screen direction of the device.|
| locale | string | Yes | No | Current system language. | | locale | string | Yes | No | Current system language. |
## DeviceCapability ## DeviceCapability
...@@ -183,10 +183,10 @@ Defines the device capability. ...@@ -183,10 +183,10 @@ Defines the device capability.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ------------- | ------------------------------- | -------- | -------- | ----------------------------- | | ------------- | ------------------------------- | ---- | ---- | -------- |
| screenDensity | [ScreenDensity](#screendensity) | Yes | No | Screen density of the device. | | screenDensity | [ScreenDensity](#screendensity) | Yes | No | Screen density of the device.|
| deviceType | [DeviceType](#devicetype) | Yes | No | Type of the device. | | deviceType | [DeviceType](#devicetype) | Yes | No | Type of the device. |
## RawFileDescriptor<sup>8+</sup> ## RawFileDescriptor<sup>8+</sup>
...@@ -194,11 +194,11 @@ Defines the device capability. ...@@ -194,11 +194,11 @@ Defines the device capability.
Defines the descriptor information of the raw file.<br> Defines the descriptor information of the raw file.<br>
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name | Type | Description | | Name | Type | Description |
| ------ | ------ | ---------------------------------------- | | ------ | ------ | ------------------ |
| fd | number | Descriptor of a raw file. | | fd | number | Descriptor of a raw file.|
| offset | number | Offset to the start position of the raw file. | | offset | number | Offset to the start position of the raw file. |
| length | number | Length of the raw file. | | length | number | Length of the raw file. |
## ResourceManager ## ResourceManager
...@@ -220,10 +220,10 @@ Obtains the string corresponding to the specified resource ID. This method uses ...@@ -220,10 +220,10 @@ Obtains the string corresponding to the specified resource ID. This method uses
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | --------------------------- | --------- | ---------------------------------------- | | -------- | --------------------------- | ---- | --------------- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the string obtained. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the string obtained.|
**Example** **Example**
``` ```
...@@ -248,14 +248,14 @@ Obtains the string corresponding to the specified resource ID. This method uses ...@@ -248,14 +248,14 @@ Obtains the string corresponding to the specified resource ID. This method uses
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ------------ | | ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ---------------------------------------- | | --------------------- | ----------- |
| Promise&lt;string&gt; | Promise used to return the string obtained. | | Promise&lt;string&gt; | Promise used to return the string obtained.|
**Example** **Example**
``` ```
...@@ -278,10 +278,10 @@ Obtains the array of strings corresponding to the specified resource ID. This me ...@@ -278,10 +278,10 @@ Obtains the array of strings corresponding to the specified resource ID. This me
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ----------------- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the obtained array of strings. | | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the obtained array of strings.|
**Example** **Example**
``` ```
...@@ -306,14 +306,14 @@ Obtains the array of strings corresponding to the specified resource ID. This me ...@@ -306,14 +306,14 @@ Obtains the array of strings corresponding to the specified resource ID. This me
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ------------ | | ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | ---------------------------------------- | | ---------------------------------- | ------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the array of strings obtained. | | Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the array of strings obtained.|
**Example** **Example**
``` ```
...@@ -336,10 +336,10 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -336,10 +336,10 @@ Obtains the content of the media file corresponding to the specified resource ID
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------------- | --------- | ---------------------------------------- | | -------- | ------------------------------- | ---- | ------------------ |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the content of the media file obtained. | | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the content of the media file obtained.|
**Example** **Example**
``` ```
...@@ -364,14 +364,14 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -364,14 +364,14 @@ Obtains the content of the media file corresponding to the specified resource ID
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ------------ | | ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------- | ---------------------------------------- | | ------------------------- | -------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the content of the media file obtained. | | Promise&lt;Uint8Array&gt; | Promise used to return the content of the media file obtained.|
**Example** **Example**
``` ```
...@@ -394,10 +394,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. ...@@ -394,10 +394,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | --------------------------- | --------- | ---------------------------------------- | | -------- | --------------------------- | ---- | ------------------------ |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the Base64 code of the image obtained. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the Base64 code of the image obtained.|
**Example** **Example**
``` ```
...@@ -422,14 +422,14 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. ...@@ -422,14 +422,14 @@ Obtains the Base64 code of the image corresponding to the specified resource ID.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ------------ | | ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ---------------------------------------- | | --------------------- | -------------------- |
| Promise&lt;string&gt; | Promise used to return the Base64 code of the image obtained. | | Promise&lt;string&gt; | Promise used to return the Base64 code of the image obtained.|
**Example** **Example**
``` ```
...@@ -452,9 +452,9 @@ Obtains the device configuration. This method uses an asynchronous callback to r ...@@ -452,9 +452,9 @@ Obtains the device configuration. This method uses an asynchronous callback to r
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ------------------------- |
| callback | AsyncCallback&lt;[Configuration](#configuration)&gt; | Yes | Callback used to return the obtained device configuration. | | callback | AsyncCallback&lt;[Configuration](#configuration)&gt; | Yes | Callback used to return the obtained device configuration.|
**Example** **Example**
``` ```
...@@ -479,9 +479,9 @@ Obtains the device configuration. This method uses a promise to return the resul ...@@ -479,9 +479,9 @@ Obtains the device configuration. This method uses a promise to return the resul
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ---------------- |
| Promise&lt;[Configuration](#configuration)&gt; | Promise used to return the device configuration. | | Promise&lt;[Configuration](#configuration)&gt; | Promise used to return the device configuration.|
**Example** **Example**
``` ```
...@@ -504,9 +504,9 @@ Obtains the device capability. This method uses an asynchronous callback to retu ...@@ -504,9 +504,9 @@ Obtains the device capability. This method uses an asynchronous callback to retu
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback&lt;[DeviceCapability](#devicecapability)&gt; | Yes | Callback used to return the obtained device capability. | | callback | AsyncCallback&lt;[DeviceCapability](#devicecapability)&gt; | Yes | Callback used to return the obtained device capability.|
**Example** **Example**
``` ```
...@@ -531,9 +531,9 @@ Obtains the device capability. This method uses a promise to return the result. ...@@ -531,9 +531,9 @@ Obtains the device capability. This method uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[DeviceCapability](#devicecapability)&gt; | Promise used to return the obtained device capability. | | Promise&lt;[DeviceCapability](#devicecapability)&gt; | Promise used to return the obtained device capability.|
**Example** **Example**
``` ```
...@@ -556,11 +556,11 @@ Obtains the specified number of singular-plural strings corresponding to the spe ...@@ -556,11 +556,11 @@ Obtains the specified number of singular-plural strings corresponding to the spe
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | --------------------------- | --------- | ---------------------------------------- | | -------- | --------------------------- | ---- | ------------------------------- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| num | number | Yes | Number that determines the plural or singular form. | | num | number | Yes | Number that determines the plural or singular form. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the singular-plural string obtained. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the singular-plural string obtained.|
**Example** **Example**
``` ```
...@@ -585,15 +585,15 @@ Obtains the specified number of singular-plural strings corresponding to the spe ...@@ -585,15 +585,15 @@ Obtains the specified number of singular-plural strings corresponding to the spe
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ---------------------------------------- | | ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID.|
| num | number | Yes | Number that determines the plural or singular form. | | num | number | Yes | Number that determines the plural or singular form. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ---------------------------------------- | | --------------------- | ------------------------- |
| Promise&lt;string&gt; | Promise used to return the singular-plural string obtained. | | Promise&lt;string&gt; | Promise used to return the singular-plural string obtained.|
**Example** **Example**
``` ```
...@@ -615,10 +615,10 @@ Obtains the content of the raw file in the specified path. This method uses an a ...@@ -615,10 +615,10 @@ Obtains the content of the raw file in the specified path. This method uses an a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------------- | --------- | ---------------------------------------- | | -------- | ------------------------------- | ---- | ----------------------- |
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the raw file content, in byte arrays. | | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the raw file content, in byte arrays.|
**Example** **Example**
``` ```
...@@ -642,14 +642,14 @@ Obtains the content of the raw file in the specified path. This method uses a pr ...@@ -642,14 +642,14 @@ Obtains the content of the raw file in the specified path. This method uses a pr
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | --------- | --------------------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------- | ---------------------------------------- | | ------------------------- | ----------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the raw file content, in byte arrays. | | Promise&lt;Uint8Array&gt; | Promise used to return the raw file content, in byte arrays.|
**Example** **Example**
``` ```
...@@ -671,10 +671,10 @@ Obtains the descriptor of the raw file in the specified path. This method uses a ...@@ -671,10 +671,10 @@ Obtains the descriptor of the raw file in the specified path. This method uses a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | -------------------------------- |
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file. |
| callback | AsyncCallback&lt;[RawFileDescriptor](#rawfiledescriptor8+</sup)&gt; | Yes | Callback used to return the raw file descriptor. | | callback | AsyncCallback&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Yes | Callback used to return the raw file descriptor.|
**Example** **Example**
``` ```
...@@ -700,14 +700,14 @@ Obtains the descriptor of the raw file in the specified path. This method uses a ...@@ -700,14 +700,14 @@ Obtains the descriptor of the raw file in the specified path. This method uses a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | --------- | --------------------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Promise used to return the raw file descriptor. | | Promise&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Promise used to return the raw file descriptor.|
**Example** **Example**
``` ```
...@@ -731,10 +731,10 @@ Closes the descriptor of the raw file in the specified path. This method uses an ...@@ -731,10 +731,10 @@ Closes the descriptor of the raw file in the specified path. This method uses an
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | ----------------------------------- | | -------- | ------------------------- | ---- | ----------- |
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
``` ```
...@@ -756,14 +756,14 @@ Closes the descriptor of the raw file in the specified path. This method uses a ...@@ -756,14 +756,14 @@ Closes the descriptor of the raw file in the specified path. This method uses a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | --------- | --------------------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | --------------------- | | ------------------- | ---- |
| Promise&lt;void&gt; | No value is returned. | | Promise&lt;void&gt; | No value is returned.|
**Example** **Example**
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册