diff --git a/en/application-dev/reference/apis/js-apis-fileio.md b/en/application-dev/reference/apis/js-apis-fileio.md index 82e2502f69e2bcba41e1db4bc2fc32ba748a062c..181a68d508ac6a52903f2fa33c13bc24a94cee88 100644 --- a/en/application-dev/reference/apis/js-apis-fileio.md +++ b/en/application-dev/reference/apis/js-apis-fileio.md @@ -3,9 +3,9 @@ The **fileio** module provides APIs for file storage and management, including basic file management, directory management, file information statistics, and stream read and write. > **NOTE** -> -> 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 APIs provided by this module are deprecated since API version 9. You are advised to use [@ohos.file.fs](./js-apis-file-fs.md). +> +> - 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 APIs provided by this module are deprecated since API version 9. You are advised to use [@ohos.file.fs](./js-apis-file-fs.md). ## Modules to Import @@ -62,9 +62,9 @@ Obtains file information. This API uses a promise to return the result. **Return value** - | Type | Description | - | ---------------------------- | ---------- | - | Promise<[Stat](#stat)> | Promise used to return the file information obtained.| +| Type | Description | +| ---------------------------- | ---------- | +| Promise<[Stat](#stat)> | Promise used to return the file information obtained.| **Example** @@ -119,9 +119,9 @@ Synchronously obtains file information. **Return value** - | Type | Description | - | ------------- | ---------- | - | [Stat](#stat) | File information obtained.| +| Type | Description | +| ------------- | ---------- | +| [Stat](#stat) | File information obtained.| **Example** @@ -147,9 +147,9 @@ Opens a file directory. This API uses a promise to return the result. **Return value** - | Type | Description | - | -------------------------- | -------- | - | Promise<[Dir](#dir)> | Promise used to return the **Dir** object.| +| Type | Description | +| -------------------------- | -------- | +| Promise<[Dir](#dir)> | Promise used to return the **Dir** object.| **Example** @@ -205,9 +205,9 @@ Synchronously opens a directory. **Return value** - | Type | Description | - | ----------- | -------- | - | [Dir](#dir) | A **Dir** instance corresponding to the directory.| +| Type | Description | +| ----------- | -------- | +| [Dir](#dir) | A **Dir** instance corresponding to the directory.| **Example** @@ -235,9 +235,9 @@ Checks whether the current process can access a file. This API uses a promise to **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -314,15 +314,15 @@ Closes a file. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to close.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to close.| **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -347,10 +347,10 @@ Closes a file. This API uses an asynchronous callback to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to close.| - | callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to close.| +| callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| **Example** @@ -373,9 +373,9 @@ Synchronously closes a file. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to close.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to close.| **Example** @@ -396,17 +396,17 @@ Copies a file. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | -------------------------- | ---- | ---------------------------------------- | - | src | string\|number | Yes | Path or file descriptor of the file to copy. | - | dest | string\|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.| +| Name | Type | Mandatory | Description | +| ---- | -------------------------- | ---- | ---------------------------------------- | +| src | string\|number | Yes | Path or file descriptor of the file to copy. | +| dest | string\|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.| **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -431,12 +431,12 @@ Copies a file. This API uses an asynchronous callback to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------------------------- | ---- | ---------------------------------------- | - | src | string\|number | Yes | Path or file descriptor of the file to copy. | - | dest | string\|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.| - | callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | +| Name | Type | Mandatory | Description | +| -------- | -------------------------- | ---- | ---------------------------------------- | +| src | string\|number | Yes | Path or file descriptor of the file to copy. | +| dest | string\|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.| +| callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | **Example** @@ -459,11 +459,11 @@ Synchronously copies a file. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | -------------------------- | ---- | ---------------------------------------- | - | src | string\|number | Yes | Path or file descriptor of the file to copy. | - | dest | string\|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.| +| Name | Type | Mandatory | Description | +| ---- | -------------------------- | ---- | ---------------------------------------- | +| src | string\|number | Yes | Path or file descriptor of the file to copy. | +| dest | string\|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.| **Example** @@ -491,9 +491,9 @@ Creates a directory. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -574,9 +574,9 @@ Opens a file. This API uses a promise to return the result. **Return value** - | Type | Description | - | --------------------- | ----------- | - | Promise<number> | Promise used to return the file descriptor of the file opened.| +| Type | Description | +| --------------------- | ----------- | +| Promise<number> | Promise used to return the file descriptor of the file opened.| **Example** @@ -635,9 +635,9 @@ Synchronously opens a file. **Return value** - | Type | Description | - | ------ | ----------- | - | number | File descriptor of the file opened.| +| Type | Description | +| ------ | ----------- | +| number | File descriptor of the file opened.| **Example** @@ -674,9 +674,9 @@ Reads data from a file. This API uses a promise to return the result. **Return value** - | Type | Description | - | ---------------------------------- | ------ | - | Promise<[ReadOut](#readout)> | Promise used to return the data read.| +| Type | Description | +| ---------------------------------- | ------ | +| Promise<[ReadOut](#readout)> | Promise used to return the data read.| **Example** @@ -703,12 +703,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------------- | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the file to read. | - | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | - | options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | - | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when the data is read asynchronously. | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the file to read. | +| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | +| options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | +| callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when the data is read asynchronously. | **Example** @@ -735,17 +735,17 @@ Synchronously reads data from a file. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ----------- | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the file to read. | - | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | - | options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | +| Name | Type | Mandatory | Description | +| ------- | ----------- | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the file to read. | +| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | +| options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | **Return value** - | Type | Description | - | ------ | -------- | - | number | Length of the data read.| +| Type | Description | +| ------ | -------- | +| number | Length of the data read.| **Example** @@ -773,9 +773,9 @@ Deletes a directory. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -853,9 +853,9 @@ Deletes a file. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -926,17 +926,17 @@ Writes data into a file. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ------------------------------- | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the file to write. | - | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | - | options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the file to write. | +| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | +| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| **Return value** - | Type | Description | - | --------------------- | -------- | - | Promise<number> | Promise used to return the length of the data written.| +| Type | Description | +| --------------------- | -------- | +| Promise<number> | Promise used to return the length of the data written.| **Example** @@ -961,12 +961,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------------- | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the file to write. | - | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | - | options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| - | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | +| Name | Type | Mandatory | Description | +| -------- | ------------------------------- | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the file to write. | +| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | +| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| +| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -991,17 +991,17 @@ Synchronously writes data into a file. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ------------------------------- | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the file to write. | - | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | - | options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the file to write. | +| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | +| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| **Return value** - | Type | Description | - | ------ | -------- | - | number | Length of the data written in the file.| +| Type | Description | +| ------ | -------- | +| number | Length of the data written in the file.| **Example** @@ -1029,9 +1029,9 @@ Calculates the hash value of a file. This API uses a promise to return the resul **Return value** - | Type | Description | - | --------------------- | -------------------------- | - | Promise<string> | Promise used to return the hash value obtained. The hash value is a hexadecimal string consisting of digits and uppercase letters.| +| Type | Description | +| --------------------- | -------------------------- | +| Promise<string> | Promise used to return the hash value obtained. The hash value is a hexadecimal string consisting of digits and uppercase letters.| **Example** @@ -1090,9 +1090,9 @@ Changes file permissions. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1165,15 +1165,15 @@ Obtains file information based on the file descriptor. This API uses a promise t **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | Descriptor of the target file.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | Descriptor of the target file.| **Return value** - | Type | Description | - | ---------------------------- | ---------- | - | Promise<[Stat](#stat)> | Promise used to return the file information.| +| Type | Description | +| ---------------------------- | ---------- | +| Promise<[Stat](#stat)> | Promise used to return the file information.| **Example** @@ -1198,10 +1198,10 @@ Obtains file information based on the file descriptor. This API uses an asynchro **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------- | ---- | ---------------- | - | fd | number | Yes | File descriptor of the target file. | - | callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the file information obtained.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------- | ---- | ---------------- | +| fd | number | Yes | File descriptor of the target file. | +| callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the file information obtained.| **Example** @@ -1224,15 +1224,15 @@ Synchronously obtains file information based on the file descriptor. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the target file.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the target file.| **Return value** - | Type | Description | - | ------------- | ---------- | - | [Stat](#stat) | File information obtained.| +| Type | Description | +| ------------- | ---------- | +| [Stat](#stat) | File information obtained.| **Example** @@ -1253,16 +1253,16 @@ Truncates a file based on the file descriptor. This API uses a promise to return **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ---------------- | - | fd | number | Yes | File descriptor of the file to truncate. | - | len | number | No | File length, in bytes, after truncation.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ---------------- | +| fd | number | Yes | File descriptor of the file to truncate. | +| len | number | No | File length, in bytes, after truncation.| **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1287,11 +1287,11 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | ---------------- | - | fd | number | Yes | File descriptor of the file to truncate. | - | len | number | No | File length, in bytes, after truncation.| - | callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | ---------------- | +| fd | number | Yes | File descriptor of the file to truncate. | +| len | number | No | File length, in bytes, after truncation.| +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -1315,10 +1315,10 @@ Synchronously truncates a file based on the file descriptor. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ---------------- | - | fd | number | Yes | File descriptor of the file to truncate. | - | len | number | No | File length, in bytes, after truncation.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ---------------- | +| fd | number | Yes | File descriptor of the file to truncate. | +| len | number | No | File length, in bytes, after truncation.| **Example** @@ -1347,9 +1347,9 @@ Truncates a file based on the file path. This API uses a promise to return the r **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1432,9 +1432,9 @@ Reads the text content of a file. This API uses a promise to return the result. **Return value** - | Type | Description | - | --------------------- | ---------- | - | Promise<string> | Promise used to return the content read.| +| Type | Description | +| --------------------- | ---------- | +| Promise<string> | Promise used to return the content read.| **Example** @@ -1491,9 +1491,9 @@ Synchronously reads the text of a file. **Return value** - | Type | Description | - | ------ | -------------------- | - | string | Promise used to return the content of the file read.| +| Type | Description | +| ------ | -------------------- | +| string | Promise used to return the content of the file read.| **Example** @@ -1519,9 +1519,9 @@ Obtains link information. This API uses a promise to return the result. **Return value** - | Type | Description | - | ---------------------------- | ---------- | - | Promise<[Stat](#stat)> | Promise used to return the link information obtained. For details, see [Stat](#stat).| +| Type | Description | +| ---------------------------- | ---------- | +| Promise<[Stat](#stat)> | Promise used to return the link information obtained. For details, see [Stat](#stat).| **Example** @@ -1576,9 +1576,9 @@ Synchronously obtains the link information. **Return value** - | Type | Description | - | ------------- | ---------- | - | [Stat](#stat) | Link information obtained.| +| Type | Description | +| ------------- | ---------- | +| [Stat](#stat) | Link information obtained.| **Example** @@ -1605,9 +1605,9 @@ Renames a file. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1682,15 +1682,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to flush.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to flush.| **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1715,10 +1715,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | --------------- | - | fd | number | Yes | File descriptor of the file to flush. | - | Callback | AsyncCallback<void> | Yes | Callback invoked when the file is synchronized in asynchronous mode.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | --------------- | +| fd | number | Yes | File descriptor of the file to flush. | +| Callback | AsyncCallback<void> | Yes | Callback invoked when the file is synchronized in asynchronous mode.| **Example** @@ -1741,9 +1741,9 @@ Flushes data of a file to disk in synchronous mode. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to flush.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to flush.| **Example** @@ -1764,15 +1764,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to flush.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to flush.| **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1797,10 +1797,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------------- | ---- | ----------------- | - | fd | number | Yes | File descriptor of the file to synchronize. | - | callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------------- | ---- | ----------------- | +| fd | number | Yes | File descriptor of the file to synchronize. | +| callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| **Example** @@ -1823,9 +1823,9 @@ Synchronizes data in a file in synchronous mode. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the file to flush.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the file to flush.| **Example** @@ -1853,9 +1853,9 @@ Creates a symbolic link based on the file path. This API uses a promise to retur **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -1939,9 +1939,9 @@ Changes the file owner based on the file path. This API uses a promise to return **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -2019,15 +2019,15 @@ Creates a temporary directory. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ------ | ------ | ---- | --------------------------- | - | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | --------------------------- | +| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| **Return value** - | Type | Description | - | --------------------- | ---------- | - | Promise<string> | Promise used to return the unique directory generated.| +| Type | Description | +| --------------------- | ---------- | +| Promise<string> | Promise used to return the unique directory generated.| **Example** @@ -2050,10 +2050,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return **Parameters** - | Name | Type | Mandatory | Description | - | -------- | --------------------------- | ---- | --------------------------- | - | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| - | callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. | +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | --------------------------- | +| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| +| callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. | **Example** @@ -2074,15 +2074,15 @@ Synchronously creates a temporary directory. **Parameters** - | Name | Type | Mandatory | Description | - | ------ | ------ | ---- | --------------------------- | - | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | --------------------------- | +| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| **Return value** - | Type | Description | - | ------ | ---------- | - | string | Unique path generated.| +| Type | Description | +| ------ | ---------- | +| string | Unique path generated.| **Example** @@ -2101,16 +2101,16 @@ Changes file permissions based on the file descriptor. This API uses a promise t **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ---------------------------------------- | - | 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 (|).<br>- **0o700**: The owner has the read, write, and execute permissions.<br>- **0o400**: The owner has the read permission.<br>- **0o200**: The owner has the write permission.<br>- **0o100**: The owner has the execute permission.<br>- **0o070**: The user group has the read, write, and execute permissions.<br>- **0o040**: The user group has the read permission.<br>- **0o020**: The user group has the write permission.<br>- **0o010**: The user group has the execute permission.<br>- **0o007**: Other users have the read, write, and execute permissions.<br>- **0o004**: Other users have the read permission.<br>- **0o002**: Other users have the write permission.<br>- **0o001**: Other users have the execute permission.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ---------------------------------------- | +| 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 (|).<br>- **0o700**: The owner has the read, write, and execute permissions.<br>- **0o400**: The owner has the read permission.<br>- **0o200**: The owner has the write permission.<br>- **0o100**: The owner has the execute permission.<br>- **0o070**: The user group has the read, write, and execute permissions.<br>- **0o040**: The user group has the read permission.<br>- **0o020**: The user group has the write permission.<br>- **0o010**: The user group has the execute permission.<br>- **0o007**: Other users have the read, write, and execute permissions.<br>- **0o004**: Other users have the read permission.<br>- **0o002**: Other users have the write permission.<br>- **0o001**: Other users have the execute permission.| **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -2136,11 +2136,11 @@ Changes file permissions based on the file descriptor. This API uses an asynchro **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------------- | ---- | ---------------------------------------- | - | 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 (|).<br>- **0o700**: The owner has the read, write, and execute permissions.<br>- **0o400**: The owner has the read permission.<br>- **0o200**: The owner has the write permission.<br>- **0o100**: The owner has the execute permission.<br>- **0o070**: The user group has the read, write, and execute permissions.<br>- **0o040**: The user group has the read permission.<br>- **0o020**: The user group has the write permission.<br>- **0o010**: The user group has the execute permission.<br>- **0o007**: Other users have the read, write, and execute permissions.<br>- **0o004**: Other users have the read permission.<br>- **0o002**: Other users have the write permission.<br>- **0o001**: Other users have the execute permission.| - | callback | AsyncCallback<void> | Yes | Callback invoked when the file permissions are changed asynchronously. | +| Name | Type | Mandatory | Description | +| -------- | ------------------------------- | ---- | ---------------------------------------- | +| 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 (|).<br>- **0o700**: The owner has the read, write, and execute permissions.<br>- **0o400**: The owner has the read permission.<br>- **0o200**: The owner has the write permission.<br>- **0o100**: The owner has the execute permission.<br>- **0o070**: The user group has the read, write, and execute permissions.<br>- **0o040**: The user group has the read permission.<br>- **0o020**: The user group has the write permission.<br>- **0o010**: The user group has the execute permission.<br>- **0o007**: Other users have the read, write, and execute permissions.<br>- **0o004**: Other users have the read permission.<br>- **0o002**: Other users have the write permission.<br>- **0o001**: Other users have the execute permission.| +| callback | AsyncCallback<void> | Yes | Callback invoked when the file permissions are changed asynchronously. | **Example** @@ -2164,10 +2164,10 @@ Synchronously changes the file permissions based on the file descriptor. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ---------------------------------------- | - | 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 (|).<br>- **0o700**: The owner has the read, write, and execute permissions.<br>- **0o400**: The owner has the read permission.<br>- **0o200**: The owner has the write permission.<br>- **0o100**: The owner has the execute permission.<br>- **0o070**: The user group has the read, write, and execute permissions.<br>- **0o040**: The user group has the read permission.<br>- **0o020**: The user group has the write permission.<br>- **0o010**: The user group has the execute permission.<br>- **0o007**: Other users have the read, write, and execute permissions.<br>- **0o004**: Other users have the read permission.<br>- **0o002**: Other users have the write permission.<br>- **0o001**: Other users have the execute permission.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ---------------------------------------- | +| 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 (|).<br>- **0o700**: The owner has the read, write, and execute permissions.<br>- **0o400**: The owner has the read permission.<br>- **0o200**: The owner has the write permission.<br>- **0o100**: The owner has the execute permission.<br>- **0o070**: The user group has the read, write, and execute permissions.<br>- **0o040**: The user group has the read permission.<br>- **0o020**: The user group has the write permission.<br>- **0o010**: The user group has the execute permission.<br>- **0o007**: Other users have the read, write, and execute permissions.<br>- **0o004**: Other users have the read permission.<br>- **0o002**: Other users have the write permission.<br>- **0o001**: Other users have the execute permission.| **Example** @@ -2196,9 +2196,9 @@ Opens a file stream based on the file path. This API uses a promise to return th **Return value** - | Type | Description | - | --------------------------------- | --------- | - | Promise<[Stream](#stream)> | Promise used to return the result.| +| Type | Description | +| --------------------------------- | --------- | +| Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -2255,9 +2255,9 @@ Synchronously opens a stream based on the file path. **Return value** - | Type | Description | - | ------------------ | --------- | - | [Stream](#stream) | Stream opened.| +| Type | Description | +| ------------------ | --------- | +| [Stream](#stream) | Stream opened.| **Example** @@ -2277,16 +2277,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the target file. | - | mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **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>- **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>- **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).| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the target file. | +| mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **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>- **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>- **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** - | Type | Description | - | --------------------------------- | --------- | - | Promise<[Stream](#stream)> | Promise used to return the result.| +| Type | Description | +| --------------------------------- | --------- | +| Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -2311,11 +2311,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------------- | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the target file. | - | mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **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>- **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>- **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<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the target file. | +| mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **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>- **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>- **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<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** @@ -2338,16 +2338,16 @@ Synchronously opens a stream based on the file descriptor. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ---------------------------------------- | - | fd | number | Yes | File descriptor of the target file. | - | mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **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>- **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>- **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).| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ---------------------------------------- | +| fd | number | Yes | File descriptor of the target file. | +| mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **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>- **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>- **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** - | Type | Description | - | ------------------ | --------- | - | [Stream](#stream) | Stream opened.| +| Type | Description | +| ------------------ | --------- | +| [Stream](#stream) | Stream opened.| **Example** @@ -2368,17 +2368,17 @@ Changes the file owner based on the file descriptor. This API uses a promise to **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the target file.| - | uid | number | Yes | New UID. | - | gid | number | Yes | New GID. | +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the target file.| +| uid | number | Yes | New UID. | +| gid | number | Yes | New GID. | **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -2404,12 +2404,12 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | --------------- | - | fd | number | Yes | File descriptor of the target file. | - | uid | number | Yes | New UID. | - | gid | number | Yes | New GID. | - | callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | --------------- | +| fd | number | Yes | File descriptor of the target file. | +| uid | number | Yes | New UID. | +| gid | number | Yes | New GID. | +| callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| **Example** @@ -2433,11 +2433,11 @@ Synchronously changes the file owner based on the file descriptor. **Parameters** - | Name | Type | Mandatory | Description | - | ---- | ------ | ---- | ------------ | - | fd | number | Yes | File descriptor of the target file.| - | uid | number | Yes | New UID. | - | gid | number | Yes | New GID. | +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| fd | number | Yes | File descriptor of the target file.| +| uid | number | Yes | New UID. | +| gid | number | Yes | New GID. | **Example** @@ -2467,9 +2467,9 @@ Changes the file owner (owner of the symbolic link, not the file referred to by **Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| +| Type | Description | +| ------------------- | ---------------------------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -2555,9 +2555,9 @@ Listens for file or directory changes. This API uses an asynchronous callback to **Return value** - | Type | Description | - | -------------------- | ---------- | - | [Watcher](#watcher7) | Promise used to return the **Watcher** instance.| +| Type | Description | +| -------------------- | ---------- | +| [Watcher](#watcher7) | Promise used to return the **Watcher** instance.| **Example** @@ -2617,9 +2617,9 @@ Checks whether this file is a block special file. A block special file supports **Return value** - | Type | Description | - | ------- | ---------------- | - | boolean | Whether the file is a block special file.| +| Type | Description | +| ------- | ---------------- | +| boolean | Whether the file is a block special file.| **Example** @@ -2639,9 +2639,9 @@ Checks whether this file is a character special file. A character special file s **Return value** - | Type | Description | - | ------- | ----------------- | - | boolean | Whether the file is a character special file.| +| Type | Description | +| ------- | ----------------- | +| boolean | Whether the file is a character special file.| **Example** @@ -2661,9 +2661,9 @@ Checks whether this file is a directory. **Return value** - | Type | Description | - | ------- | ------------- | - | boolean | Whether the file is a directory.| +| Type | Description | +| ------- | ------------- | +| boolean | Whether the file is a directory.| **Example** @@ -2683,9 +2683,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int **Return value** - | Type | Description | - | ------- | --------------------- | - | boolean | Whether the file is an FIFO.| +| Type | Description | +| ------- | --------------------- | +| boolean | Whether the file is an FIFO.| **Example** @@ -2705,9 +2705,9 @@ Checks whether this file is a regular file. **Return value** - | Type | Description | - | ------- | --------------- | - | boolean | Whether the file is a regular file.| +| Type | Description | +| ------- | --------------- | +| boolean | Whether the file is a regular file.| **Example** @@ -2727,9 +2727,9 @@ Checks whether this file is a socket. **Return value** - | Type | Description | - | ------- | -------------- | - | boolean | Whether the file is a socket.| +| Type | Description | +| ------- | -------------- | +| boolean | Whether the file is a socket.| **Example** @@ -2749,9 +2749,9 @@ Checks whether this file is a symbolic link. **Return value** - | Type | Description | - | ------- | --------------- | - | boolean | Whether the file is a symbolic link.| +| Type | Description | +| ------- | --------------- | +| boolean | Whether the file is a symbolic link.| **Example** @@ -2797,9 +2797,9 @@ Stops the **watcher** instance. This API uses an asynchronous callback to return **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | ---------------------- | - | callback | AsyncCallback<void> | Yes | Callback invoked when **watcher** is stopped asynchronously.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | ---------------------- | +| callback | AsyncCallback<void> | Yes | Callback invoked when **watcher** is stopped asynchronously.| **Example** @@ -2829,9 +2829,9 @@ Closes the stream. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ------------- | - | Promise<void> | Promise used to return the stream close result.| +| Type | Description | +| ------------------- | ------------- | +| Promise<void> | Promise used to return the stream close result.| **Example** @@ -2856,9 +2856,9 @@ Closes the stream. This API uses an asynchronous callback to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | ------------- | - | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | ------------- | +| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| **Example** @@ -2898,9 +2898,9 @@ Flushes the stream. This API uses a promise to return the result. **Return value** - | Type | Description | - | ------------------- | ------------- | - | Promise<void> | Promise used to return the stream flushing result.| +| Type | Description | +| ------------------- | ------------- | +| Promise<void> | Promise used to return the stream flushing result.| **Example** @@ -2925,9 +2925,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | -------------- | - | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | -------------- | +| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| **Example** @@ -2967,16 +2967,16 @@ Writes data into the stream. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ------------------------------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | - | options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size | +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | ---- | ---------------------------------------- | +| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | +| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size | **Return value** - | Type | Description | - | --------------------- | -------- | - | Promise<number> | Promise used to return the length of the data written.| +| Type | Description | +| --------------------- | -------- | +| Promise<number> | Promise used to return the length of the data written.| **Example** @@ -3001,11 +3001,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | - | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | - | options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| - | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | +| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | +| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| +| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -3031,16 +3031,16 @@ Synchronously writes data into the stream. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ------------------------------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | - | options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size | +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | ---- | ---------------------------------------- | +| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | +| options | Object | No | The options are as follows:<br>- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.<br>- **length** (number): length of the data to write. The default value is the buffer length minus the offset.<br>- **position** (number): start position to write the data in the file. By default, data is written from the current position.<br>- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.<br>Constraints: offset + length <= Buffer size | **Return value** - | Type | Description | - | ------ | -------- | - | number | Length of the data written in the file.| +| Type | Description | +| ------ | -------- | +| number | Length of the data written in the file.| **Example** @@ -3061,16 +3061,16 @@ Reads data from the stream. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ----------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | - | options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | +| Name | Type | Mandatory | Description | +| ------- | ----------- | ---- | ---------------------------------------- | +| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | +| options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | **Return value** - | Type | Description | - | ---------------------------------- | ------ | - | Promise<[ReadOut](#readout)> | Promise used to return the data read.| +| Type | Description | +| ---------------------------------- | ------ | +| Promise<[ReadOut](#readout)> | Promise used to return the data read.| **Example** @@ -3096,11 +3096,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the **Parameters** - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | - | options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | - | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when data is read asynchronously from the stream. | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | +| options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | +| callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when data is read asynchronously from the stream. | **Example** @@ -3126,16 +3126,16 @@ Synchronously reads data from the stream. **Parameters** - | Name | Type | Mandatory | Description | - | ------- | ----------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | - | options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | +| Name | Type | Mandatory | Description | +| ------- | ----------- | ---- | ---------------------------------------- | +| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | +| options | Object | No | The options are as follows:<br>- **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>- **length** (number): length of the data to read. The default value is the buffer length minus the offset.<br>- **position** (number): position of the data to read in the file. By default, data is read from the current position.<br>Constraints: offset + length <= Buffer size | **Return value** - | Type | Description | - | ------ | -------- | - | number | Length of the data read.| +| Type | Description | +| ------ | -------- | +| number | Length of the data read.| **Example** @@ -3161,9 +3161,9 @@ Reads the next directory entry. This API uses a promise to return the result. **Return value** - | Type | Description | - | -------------------------------- | ------------- | - | Promise<[Dirent](#dirent)> | Promise used to return the directory entry read.| +| Type | Description | +| -------------------------------- | ------------- | +| Promise<[Dirent](#dirent)> | Promise used to return the directory entry read.| **Example** @@ -3186,9 +3186,9 @@ Reads the next directory entry. This API uses an asynchronous callback to return **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | ---- | ---------------- | - | callback | AsyncCallback<[Dirent](#dirent)> | Yes | Callback invoked when the next directory entry is asynchronously read.| +| Name | Type | Mandatory | Description | +| -------- | -------------------------------------- | ---- | ---------------- | +| callback | AsyncCallback<[Dirent](#dirent)> | Yes | Callback invoked when the next directory entry is asynchronously read.| **Example** @@ -3212,9 +3212,9 @@ Synchronously reads the next directory entry. **Return value** - | Type | Description | - | ----------------- | -------- | - | [Dirent](#dirent) | Directory entry read.| +| Type | Description | +| ----------------- | -------- | +| [Dirent](#dirent) | Directory entry read.| **Example** @@ -3295,9 +3295,9 @@ Checks whether this directory entry is a block special file. A block special fil **Return value** - | Type | Description | - | ------- | ---------------- | - | boolean | Whether the directory entry is a block special file.| +| Type | Description | +| ------- | ---------------- | +| boolean | Whether the directory entry is a block special file.| **Example** @@ -3317,9 +3317,9 @@ Checks whether a directory entry is a character special file. A character specia **Return value** - | Type | Description | - | ------- | ----------------- | - | boolean | Whether the directory entry is a character special file.| +| Type | Description | +| ------- | ----------------- | +| boolean | Whether the directory entry is a character special file.| **Example** @@ -3339,9 +3339,9 @@ Checks whether a directory entry is a directory. **Return value** - | Type | Description | - | ------- | ------------- | - | boolean | Whether the directory entry is a directory.| +| Type | Description | +| ------- | ------------- | +| boolean | Whether the directory entry is a directory.| **Example** @@ -3361,9 +3361,9 @@ Checks whether this directory entry is a named pipe (or FIFO). Named pipes are u **Return value** - | Type | Description | - | ------- | --------------- | - | boolean | Whether the directory entry is a FIFO.| +| Type | Description | +| ------- | --------------- | +| boolean | Whether the directory entry is a FIFO.| **Example** @@ -3383,9 +3383,9 @@ Checks whether a directory entry is a regular file. **Return value** - | Type | Description | - | ------- | --------------- | - | boolean | Whether the directory entry is a regular file.| +| Type | Description | +| ------- | --------------- | +| boolean | Whether the directory entry is a regular file.| **Example** @@ -3405,9 +3405,9 @@ Checks whether a directory entry is a socket. **Return value** - | Type | Description | - | ------- | -------------- | - | boolean | Whether the directory entry is a socket.| +| Type | Description | +| ------- | -------------- | +| boolean | Whether the directory entry is a socket.| **Example** @@ -3427,9 +3427,9 @@ Checks whether a directory entry is a symbolic link. **Return value** - | Type | Description | - | ------- | --------------- | - | boolean | Whether the directory entry is a symbolic link.| +| Type | Description | +| ------- | --------------- | +| boolean | Whether the directory entry is a symbolic link.| **Example** @@ -3437,22 +3437,3 @@ Checks whether a directory entry is a symbolic link. let dir = fileio.opendirSync(pathDir); let isSymbolicLink = dir.readSync().isSymbolicLink(); ``` - -## Filter<sup>9+</sup> - -**System API**: This is a system API. - -**System capability**: SystemCapability.FileManagement.File.FileIO - -Defines the file filter configuration. - -| Name | Type | Description | -| ----------- | --------------- | ------------------ | -| suffix | Array<string> | File name extensions. The keywords in the array are of the OR relationship. | -| displayName | Array<string> | File names for fuzzy match. The keywords in the array are of the OR relationship.| -| mimeType | Array<string> | MIME types to match. The keywords in the array are of the OR relationship. | -| fileSizeOver | number | File size to match. The files which are of the same or a lager size are matched. | -| lastModifiedAfter | Date | File modification time to match. The files modified after the specified time are matched. | -| excludeMedia | Boolean | Whether to exclude the files already in Media. | - -<!--no_check--> \ No newline at end of file