提交 f67a5948 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 028fdcb7
...@@ -16,7 +16,7 @@ import wifiManager from '@ohos.enterprise.wifiManager'; ...@@ -16,7 +16,7 @@ import wifiManager from '@ohos.enterprise.wifiManager';
isWifiActive(admin: Want, callback: AsyncCallback&lt;boolean&gt;): void isWifiActive(admin: Want, callback: AsyncCallback&lt;boolean&gt;): void
Checks whether Wi-Fi is enabled. This API uses an asynchronous callback to return the result. Checks whether Wi-Fi is active. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI **Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
...@@ -28,8 +28,8 @@ Checks whether Wi-Fi is enabled. This API uses an asynchronous callback to retur ...@@ -28,8 +28,8 @@ Checks whether Wi-Fi is enabled. This API uses an asynchronous callback to retur
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- | | -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that checks the Wi-Fi status. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return whether Wi-Fi is enabled. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** indicates that Wi-Fi is active; and **false** indicates that Wi-Fi is inactive). If the operation fails, **err** is an error object. |
**Error codes** **Error codes**
...@@ -72,13 +72,13 @@ Checks whether Wi-Fi is active. This API uses a promise to return the result. ...@@ -72,13 +72,13 @@ Checks whether Wi-Fi is active. This API uses a promise to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- | | ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| | admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that checks the Wi-Fi status.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------- | | --------------------- | ------------------------- |
| Promise&lt;boolean&gt; | Promise used to return whether Wi-Fi is active. | | Promise&lt;boolean&gt; | Promise used to return the result. The value **true** indicates that Wi-Fi is active, and the value **false** indicates that Wi-Fi is inactive. |
**Error codes** **Error codes**
...@@ -102,3 +102,247 @@ wifiManager.isWifiActive(wantTemp).then((result) => { ...@@ -102,3 +102,247 @@ wifiManager.isWifiActive(wantTemp).then((result) => {
console.log("error code:" + error.code + " error message:" + error.message); console.log("error code:" + error.code + " error message:" + error.message);
}); });
``` ```
## wifiManager.setWifiProfile
setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback&lt;void&gt;): void
Sets Wi-Fi to connect to the specified network. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that sets the Wi-Fi profile. |
| profile | [WifiProfile](#wifiprofile) | Yes | WLAN configuration. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.setWifiProfile(wantTemp, profile, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("set wifi success");
});
```
## wifiManager.setWifiProfile
setWifiProfile(admin: Want, profile: WifiProfile): Promise&lt;void&gt;
Sets Wi-Fi to connect to the specified network. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that sets the Wi-Fi profile.|
| profile | [WifiProfile](#wifiprofile) | Yes | WLAN configuration. |
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.isWifiActive(wantTemp, profile).then(() => {
console.log("set wifi success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## WifiProfile
Represents the WLAN configuration.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| Name | Type | Readable| Writable | Description |
| ----------- | --------| ---- | ----- | ------------------------------- |
| ssid | string | Yes| No| Service set identifier (SSID) of the hotspot, in UTF-8 format.|
| bssid | string | Yes| No| Basic service set identifier (BSSID) of the hotspot.|
| preSharedKey | string | Yes| No| Pre-shared key (PSK) of the hotspot.|
| isHiddenSsid | boolean | Yes| No| Whether the network is hidden.|
| securityType | [WifiSecurityType](#wifisecuritytype) | Yes| No| Security type.|
| creatorUid | number | Yes| No| ID of the creator.|
| disableReason | number | Yes| No| Reason for disabling Wi-Fi.|
| netId | number | Yes| No| Network ID allocated.|
| randomMacType | number | Yes| No| Type of the random MAC.|
| randomMacAddr | string | Yes| No| Random MAC address.|
| ipType | [IpType](#iptype) | Yes| No| IP address type.|
| staticIp | [IpProfile](#ipprofile) | Yes| No| Static IP address information.|
| eapProfile | [WifiEapProfile](#wifieapprofile) | Yes| No| Extensible Authentication Protocol (EAP) configuration.|
## WifiSecurityType
Enumerates the Wi-Fi security types.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| Name| Value| Description|
| -------- | -------- | -------- |
| WIFI_SEC_TYPE_INVALID | 0 | Invalid security type.|
| WIFI_SEC_TYPE_OPEN | 1 | Open security type.|
| WIFI_SEC_TYPE_WEP | 2 | Wired Equivalent Privacy (WEP).|
| WIFI_SEC_TYPE_PSK | 3 | PSK.|
| WIFI_SEC_TYPE_SAE | 4 | Simultaneous Authentication of Equals (SAE).|
| WIFI_SEC_TYPE_EAP | 5 | EAP.|
| WIFI_SEC_TYPE_EAP_SUITE_B | 6 | Suite B 192-bit encryption.|
| WIFI_SEC_TYPE_OWE | 7 | Opportunistic Wireless Encryption (OWE).|
| WIFI_SEC_TYPE_WAPI_CERT | 8 | WLAN Authentication and Privacy Infrastructure (WAPI) in certificate-based mode (WAPI-CERT).|
| WIFI_SEC_TYPE_WAPI_PSK | 9 | WAPI-PSK.|
## IpType
Enumerates the IP address types.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| Name| Value| Description|
| -------- | -------- | -------- |
| STATIC | 0 | Static IP address.|
| DHCP | 1 | IP address allocated by DHCP.|
| UNKNOWN | 2 | Not specified.|
## IpProfile
Represents IP configuration information.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| ipAddress | number | Yes| No| IP address.|
| gateway | number | Yes| No| Gateway.|
| prefixLength | number | Yes| No| Subnet mask.|
| dnsServers | number[] | Yes| No| Domain name server (DNS) information.|
| domains | Array&lt;string&gt; | Yes| No| Domain information.|
## WifiEapProfile
Represents EAP profile (configuration) information.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| **Name**| **Type**| **Readable**| **Writable**| **Description**|
| -------- | -------- | -------- | -------- | -------- |
| eapMethod | [EapMethod](#eapmethod) | Yes| No| EAP authentication method.|
| phase2Method | [Phase2Method](#phase2method) | Yes| No| Phase 2 authentication method.|
| identity | string | Yes| No| Identity Information.|
| anonymousIdentity | string | Yes| No| Anonymous identity.|
| password | string | Yes| No| Password.|
| caCertAliases | string | Yes| No| CA certificate alias.|
| caPath | string | Yes| No| CA certificate path.|
| clientCertAliases | string | Yes| No| Client certificate alias.|
| certEntry | Uint8Array | Yes| Yes| CA certificate content.|
| certPassword | string | Yes| Yes| CA certificate password.|
| altSubjectMatch | string | Yes| No| A string to match the alternate subject.|
| domainSuffixMatch | string | Yes| No| A string to match the domain suffix.|
| realm | string | Yes| No| Realm for the passpoint credential.|
| plmn | string | Yes| No| Public land mobile network (PLMN) of the passpoint credential provider.|
| eapSubId | number | Yes| No| Sub-ID of the SIM card.|
## EapMethod
Enumerates the EAP authentication methods.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| Name| Value| Description|
| -------- | -------- | -------- |
| EAP_NONE | 0 | Not specified.|
| EAP_PEAP | 1 | PEAP.|
| EAP_TLS | 2 | TLS.|
| EAP_TTLS | 3 | TTLS.|
| EAP_PWD | 4 | Password.|
| EAP_SIM | 5 | SIM.|
| EAP_AKA | 6 | AKA.|
| EAP_AKA_PRIME | 7 | AKA Prime.|
| EAP_UNAUTH_TLS | 8 | UNAUTH TLS.|
## Phase2Method
Enumerates the Phase 2 authentication methods.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
| Name| Value| Description|
| -------- | -------- | -------- |
| PHASE2_NONE | 0 | Not specified.|
| PHASE2_PAP | 1 | PAP.|
| PHASE2_MSCHAP | 2 | MS-CHAP.|
| PHASE2_MSCHAPV2 | 3 | MS-CHAPv2.|
| PHASE2_GTC | 4 | GTC .|
| PHASE2_SIM | 5 | SIM.|
| PHASE2_AKA | 6 | AKA.|
| PHASE2_AKA_PRIME | 7 | AKA Prime.|
# @ohos.file.picker (File Picker) # @ohos.file.picker (File Picker)
The File Picker encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving photos, documents, and audio clips. The application can select the picker as required. **Picker** encapsulates the system applications such as **PhotoViewPicker**, **DocumentViewPicker** and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. The application can select the picker as required.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
```js ```js
import picker from '@ohos.file.picker'; import picker from '@ohos.file.picker';
...@@ -28,7 +27,7 @@ let photoPicker = new picker.PhotoViewPicker(); ...@@ -28,7 +27,7 @@ let photoPicker = new picker.PhotoViewPicker();
select(option?: PhotoSelectOptions) : Promise&lt;PhotoSelectResult&gt; select(option?: PhotoSelectOptions) : Promise&lt;PhotoSelectResult&gt;
Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select. Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -36,7 +35,7 @@ Selects one or more images or videos in a **photoPicker** page. This API uses a ...@@ -36,7 +35,7 @@ Selects one or more images or videos in a **photoPicker** page. This API uses a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting images or videos.| | option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting files. If this parameter is not specified, images and videos are selected by default. A maximum of 50 files can be selected.|
**Return value** **Return value**
...@@ -68,7 +67,7 @@ async function example() { ...@@ -68,7 +67,7 @@ async function example() {
select(option: PhotoSelectOptions, callback: AsyncCallback&lt;PhotoSelectResult&gt;) : void select(option: PhotoSelectOptions, callback: AsyncCallback&lt;PhotoSelectResult&gt;) : void
Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select. Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -146,7 +145,7 @@ Saves one or more images or videos in a **photoPicker** page. This API uses a pr ...@@ -146,7 +145,7 @@ Saves one or more images or videos in a **photoPicker** page. This API uses a pr
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving images or videos.| | option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving files. If this parameter is not specified, a **photoPicker** page will be displayed for the user to enter the names of the files to save.|
**Return value** **Return value**
...@@ -266,7 +265,7 @@ Selects one or more documents in a **documentPicker** page. This API uses a prom ...@@ -266,7 +265,7 @@ Selects one or more documents in a **documentPicker** page. This API uses a prom
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [DocumentSelectOptions](#documentselectoptions) | No | Options for selecting documents.| | option | [DocumentSelectOptions](#documentselectoptions) | No | Options for select documents. If this parameter is not specified, the **documentPicker** page is displayed by default.|
**Return value** **Return value**
...@@ -373,7 +372,7 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis ...@@ -373,7 +372,7 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents.| | option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents. If this parameter is not specified, a **documentPicker** page will be displayed for the user to enter the names of the documents to save.|
**Return value** **Return value**
...@@ -493,7 +492,7 @@ Selects one or more audio files in an **audioPicker** page (currently, a **docum ...@@ -493,7 +492,7 @@ Selects one or more audio files in an **audioPicker** page (currently, a **docum
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting audio files.| | option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting the audio files. If this parameter is not specified, the **audioPicker** page is displayed by default. |
**Return value** **Return value**
...@@ -591,7 +590,7 @@ async function example() { ...@@ -591,7 +590,7 @@ async function example() {
save(option?: AudioSaveOptions) : Promise&lt;Array&lt;string&gt;&gt; save(option?: AudioSaveOptions) : Promise&lt;Array&lt;string&gt;&gt;
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save. Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -599,7 +598,7 @@ Saves one or more audio files in an **audioPicker** page (currently, a **documen ...@@ -599,7 +598,7 @@ Saves one or more audio files in an **audioPicker** page (currently, a **documen
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------- | ---- | -------------------------- | | ------- | ------- | ---- | -------------------------- |
| option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files.| | option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files. If this parameter is not specified, an **audioPicker** page will be displayed for the user to enter the names of the files to save.|
**Return value** **Return value**
...@@ -630,7 +629,7 @@ async function example() { ...@@ -630,7 +629,7 @@ async function example() {
save(option: AudioSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void save(option: AudioSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save. Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -715,7 +714,7 @@ Defines the options for selecting images or videos. ...@@ -715,7 +714,7 @@ Defines the options for selecting images or videos.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | -------------------------------- | | ----------------------- | ------------------- | ---- | -------------------------------- |
| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | No | Media file types to select.| | MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | No | Available media file types. **IMAGE_VIDEO_TYPE** is used by default.|
| maxSelectNumber? | number | No | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**. | | maxSelectNumber? | number | No | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**. |
## PhotoSelectResult ## PhotoSelectResult
...@@ -737,7 +736,7 @@ Defines the options for saving images or videos. ...@@ -737,7 +736,7 @@ Defines the options for saving images or videos.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---------------------------- | | ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames? | Array&lt;string&gt; | No | Files names of the images or videos to save.| | newFileNames? | Array&lt;string&gt; | No | Names of the files to save. If this parameter is not specified, the user needs to enter the file names.|
## DocumentSelectOptions ## DocumentSelectOptions
...@@ -753,11 +752,11 @@ Defines the options for saving documents. ...@@ -753,11 +752,11 @@ Defines the options for saving documents.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---------------------------- | | ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames? | Array&lt;string&gt; | No | File names of the documents to save.| | newFileNames? | Array&lt;string&gt; | No | Names of the documents to save. If this parameter is not specified, the user needs to enter the document names. |
## AudioSelectOptions ## AudioSelectOptions
Defines the options for selecting audio clips. Currently, this parameter cannot be configured. Defines the options for selecting audio files. Currently, this parameter cannot be configured.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -769,4 +768,4 @@ Defines the options for saving audio files. ...@@ -769,4 +768,4 @@ Defines the options for saving audio files.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ---------------------------- | | ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames? | Array&lt;string&gt; | No | File names of the audio clips to save.| | newFileNames? | Array&lt;string&gt; | No | Name of the audio files to save. If this parameter is not specified, the user needs to enter the file names.|
...@@ -62,9 +62,9 @@ Obtains file information. This API uses a promise to return the result. ...@@ -62,9 +62,9 @@ Obtains file information. This API uses a promise to return the result.
**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**
...@@ -119,9 +119,9 @@ Synchronously obtains file information. ...@@ -119,9 +119,9 @@ Synchronously obtains file information.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------- | ---------- | | ------------- | ---------- |
| [Stat](#stat) | File information obtained.| | [Stat](#stat) | File information obtained.|
**Example** **Example**
...@@ -147,9 +147,9 @@ Opens a file directory. This API uses a promise to return the result. ...@@ -147,9 +147,9 @@ Opens a file directory. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------------------- | -------- | | -------------------------- | -------- |
| Promise&lt;[Dir](#dir)&gt; | Promise used to return the **Dir** object.| | Promise&lt;[Dir](#dir)&gt; | Promise used to return the **Dir** object.|
**Example** **Example**
...@@ -205,9 +205,9 @@ Synchronously opens a directory. ...@@ -205,9 +205,9 @@ Synchronously opens a directory.
**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**
...@@ -235,9 +235,9 @@ Checks whether the current process can access a file. This API uses a promise to ...@@ -235,9 +235,9 @@ Checks whether the current process can access a file. This API uses a promise to
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -314,15 +314,15 @@ Closes a file. This API uses a promise to return the result. ...@@ -314,15 +314,15 @@ Closes a file. This API uses a promise to return the result.
**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 that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -347,10 +347,10 @@ Closes a file. This API uses an asynchronous callback to return the result. ...@@ -347,10 +347,10 @@ Closes a file. This API uses an asynchronous callback to return the result.
**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**
...@@ -373,9 +373,9 @@ Synchronously closes a file. ...@@ -373,9 +373,9 @@ Synchronously closes a file.
**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**
...@@ -396,17 +396,17 @@ Copies a file. This API uses a promise to return the result. ...@@ -396,17 +396,17 @@ Copies a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | -------------------------- | ---- | ---------------------------------------- | | ---- | -------------------------- | ---- | ---------------------------------------- |
| src | string\|number | Yes | Path or file descriptor of the file to copy. | | 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. | | 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.| | 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 that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -431,12 +431,12 @@ Copies a file. This API uses an asynchronous callback to return the result. ...@@ -431,12 +431,12 @@ Copies a file. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------- | ---- | ---------------------------------------- | | -------- | -------------------------- | ---- | ---------------------------------------- |
| src | string\|number | Yes | Path or file descriptor of the file to copy. | | 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. | | 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.| | 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**
...@@ -459,11 +459,11 @@ Synchronously copies a file. ...@@ -459,11 +459,11 @@ Synchronously copies a file.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | -------------------------- | ---- | ---------------------------------------- | | ---- | -------------------------- | ---- | ---------------------------------------- |
| src | string\|number | Yes | Path or file descriptor of the file to copy. | | 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. | | 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.| | 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**
...@@ -487,13 +487,13 @@ Creates a directory. This API uses a promise to return the result. ...@@ -487,13 +487,13 @@ Creates a directory. This API uses a promise to return the result.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the directory. | | path | string | Yes | Application sandbox path of the directory. |
| 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>- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<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. | | 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>- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<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** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -520,7 +520,7 @@ Creates a directory. This API uses an asynchronous callback to return the result ...@@ -520,7 +520,7 @@ Creates a directory. This API uses an asynchronous callback to return the result
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the directory. | | path | string | Yes | Application sandbox path of the directory. |
| 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>- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<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. | | 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>- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<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&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**
...@@ -546,7 +546,7 @@ Synchronously creates a directory. ...@@ -546,7 +546,7 @@ Synchronously creates a directory.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the directory. | | path | string | Yes | Application sandbox path of the directory. |
| 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>- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<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. | | 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>- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.<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** **Example**
...@@ -570,13 +570,13 @@ Opens a file. This API uses a promise to return the result. ...@@ -570,13 +570,13 @@ Opens a file. This API uses a promise to return the result.
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the 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>- **0o0**: Open the file in read-only mode.<br>- **0o1**: Open the file in write-only mode.<br>- **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>- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.<br>- **0o200**: If **0o100** is added and the file already exists, throw an exception.<br>- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).<br>- **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>- **0o200000**: If **path** does not point to a directory, throw an exception.<br>- **0o400000**: If **path** points to a symbolic link, throw an exception.<br>- **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>- **0o0**: Open the file in read-only mode.<br>- **0o1**: Open the file in write-only mode.<br>- **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>- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.<br>- **0o200**: If **0o100** is added and the file already exists, throw an exception.<br>- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).<br>- **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>- **0o200000**: If **path** does not point to a directory, throw an exception.<br>- **0o400000**: If **path** points to a symbolic link, throw an exception.<br>- **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>- **0o666**: The owner, user group, and other users have the read and write permissions.<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. | | mode | number | No | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o660**.<br>- **0o660**: The owner and user group have the read and write permissions.<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** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ----------- | | --------------------- | ----------- |
| Promise&lt;number&gt; | Promise used to return the file descriptor of the file opened.| | Promise&lt;number&gt; | Promise used to return the file descriptor of the file opened.|
**Example** **Example**
...@@ -604,7 +604,7 @@ Opens a file. This API uses an asynchronous callback to return the result. ...@@ -604,7 +604,7 @@ Opens a file. This API uses an asynchronous callback to return the result.
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the 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>- **0o0**: Open the file in read-only mode.<br>- **0o1**: Open the file in write-only mode.<br>- **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>- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.<br>- **0o200**: If **0o100** is added and the file already exists, throw an exception.<br>- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).<br>- **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>- **0o200000**: If **path** does not point to a directory, throw an exception.<br>- **0o400000**: If **path** points to a symbolic link, throw an exception.<br>- **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>- **0o0**: Open the file in read-only mode.<br>- **0o1**: Open the file in write-only mode.<br>- **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>- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.<br>- **0o200**: If **0o100** is added and the file already exists, throw an exception.<br>- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).<br>- **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>- **0o200000**: If **path** does not point to a directory, throw an exception.<br>- **0o400000**: If **path** points to a symbolic link, throw an exception.<br>- **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>- **0o666**: The owner, user group, and other users have the read and write permissions.<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. | | mode | number | No | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;). The default value is **0o660**.<br>- **0o660**: The owner and user group have the read and write permissions.<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&lt;number&gt; | Yes | Callback invoked when the file is open asynchronously. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked when the file is open asynchronously. |
**Example** **Example**
...@@ -631,13 +631,13 @@ Synchronously opens a file. ...@@ -631,13 +631,13 @@ Synchronously opens a file.
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the 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>- **0o0**: Open the file in read-only mode.<br>- **0o1**: Open the file in write-only mode.<br>- **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>- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.<br>- **0o200**: If **0o100** is added and the file already exists, throw an exception.<br>- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).<br>- **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>- **0o200000**: If **path** does not point to a directory, throw an exception.<br>- **0o400000**: If **path** points to a symbolic link, throw an exception.<br>- **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>- **0o0**: Open the file in read-only mode.<br>- **0o1**: Open the file in write-only mode.<br>- **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>- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.<br>- **0o200**: If **0o100** is added and the file already exists, throw an exception.<br>- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.<br>- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).<br>- **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>- **0o200000**: If **path** does not point to a directory, throw an exception.<br>- **0o400000**: If **path** points to a symbolic link, throw an exception.<br>- **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>- **0o666**: The owner, user group, and other users have the read and write permissions.<br>- **0o640**: The owner has the read and write permissions, and the user group has the read permission.<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.<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 **0o660**.<br>- **0o660**: The owner and user group have the read and write permissions.<br>- **0o640**: The owner has the read and write permissions, and the user group has the read permission.<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.<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**
...@@ -674,9 +674,9 @@ Reads data from a file. This API uses a promise to return the result. ...@@ -674,9 +674,9 @@ Reads data from a file. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | ------ | | ---------------------------------- | ------ |
| Promise&lt;[ReadOut](#readout)&gt; | Promise used to return the data read.| | Promise&lt;[ReadOut](#readout)&gt; | Promise used to return the data read.|
**Example** **Example**
...@@ -703,12 +703,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res ...@@ -703,12 +703,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res
**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>- **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 | | 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&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**
...@@ -735,17 +735,17 @@ Synchronously reads data from a file. ...@@ -735,17 +735,17 @@ Synchronously reads data from a file.
**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>- **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 | | 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** **Return value**
| Type | Description | | Type | Description |
| ------ | -------- | | ------ | -------- |
| number | Length of the data read.| | number | Length of the data read.|
**Example** **Example**
...@@ -773,9 +773,9 @@ Deletes a directory. This API uses a promise to return the result. ...@@ -773,9 +773,9 @@ Deletes a directory. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -853,9 +853,9 @@ Deletes a file. This API uses a promise to return the result. ...@@ -853,9 +853,9 @@ Deletes a file. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -926,17 +926,17 @@ Writes data into a file. This API uses a promise to return the result. ...@@ -926,17 +926,17 @@ Writes data into a file. This API uses a promise to return the result.
**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\|string | Yes | Data to write. It can be a string or data from a buffer. | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size|
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | -------- | | --------------------- | -------- |
| Promise&lt;number&gt; | Promise used to return the length of the data written.| | Promise&lt;number&gt; | Promise used to return the length of the data written.|
**Example** **Example**
...@@ -961,12 +961,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re ...@@ -961,12 +961,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re
**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\|string | Yes | Data to write. It can be a string or data from a buffer. | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size|
| 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**
...@@ -991,17 +991,17 @@ Synchronously writes data into a file. ...@@ -991,17 +991,17 @@ Synchronously writes data into a file.
**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\|string | Yes | Data to write. It can be a string or data from a buffer. | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size|
**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**
...@@ -1029,9 +1029,9 @@ Calculates the hash value of a file. This API uses a promise to return the resul ...@@ -1029,9 +1029,9 @@ Calculates the hash value of a file. This API uses a promise to return the resul
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | -------------------------- | | --------------------- | -------------------------- |
| Promise&lt;string&gt; | Promise used to return the hash value obtained. The hash value is a hexadecimal string consisting of digits and uppercase letters.| | Promise&lt;string&gt; | Promise used to return the hash value obtained. The hash value is a hexadecimal string consisting of digits and uppercase letters.|
**Example** **Example**
...@@ -1086,13 +1086,13 @@ Changes file permissions. This API uses a promise to return the result. ...@@ -1086,13 +1086,13 @@ Changes file permissions. This API uses a promise to return the result.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the file. |
| mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1119,7 +1119,7 @@ Changes file permissions. This API uses an asynchronous callback to return the r ...@@ -1119,7 +1119,7 @@ Changes file permissions. This API uses an asynchronous callback to return the r
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the file. |
| mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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&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**
...@@ -1145,7 +1145,7 @@ Synchronously changes file permissions. ...@@ -1145,7 +1145,7 @@ Synchronously changes file permissions.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the file. |
| mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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** **Example**
...@@ -1165,15 +1165,15 @@ Obtains file information based on the file descriptor. This API uses a promise t ...@@ -1165,15 +1165,15 @@ Obtains file information based on the file descriptor. This API uses a promise t
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| fd | number | Yes | Descriptor of the target file.| | fd | number | Yes | Descriptor 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**
...@@ -1198,10 +1198,10 @@ Obtains file information based on the file descriptor. This API uses an asynchro ...@@ -1198,10 +1198,10 @@ Obtains file information based on the file descriptor. This API uses an asynchro
**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 to return the file information obtained.| | callback | AsyncCallback&lt;[Stat](#stat)&gt; | Yes | Callback invoked to return the file information obtained.|
**Example** **Example**
...@@ -1224,15 +1224,15 @@ Synchronously obtains file information based on the file descriptor. ...@@ -1224,15 +1224,15 @@ Synchronously obtains file information based on the file descriptor.
**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 information obtained.| | [Stat](#stat) | File information obtained.|
**Example** **Example**
...@@ -1253,16 +1253,16 @@ Truncates a file based on the file descriptor. This API uses a promise to return ...@@ -1253,16 +1253,16 @@ Truncates a file based on the file descriptor. This API uses a promise to return
**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.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1287,11 +1287,11 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal ...@@ -1287,11 +1287,11 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal
**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.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value. |
**Example** **Example**
...@@ -1315,10 +1315,10 @@ Synchronously truncates a file based on the file descriptor. ...@@ -1315,10 +1315,10 @@ Synchronously truncates a file based on the file descriptor.
**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**
...@@ -1347,9 +1347,9 @@ Truncates a file based on the file path. This API uses a promise to return the r ...@@ -1347,9 +1347,9 @@ Truncates a file based on the file path. This API uses a promise to return the r
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1432,9 +1432,9 @@ Reads the text content of a file. This API uses a promise to return the result. ...@@ -1432,9 +1432,9 @@ Reads the text content of a file. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ---------- | | --------------------- | ---------- |
| Promise&lt;string&gt; | Promise used to return the content read.| | Promise&lt;string&gt; | Promise used to return the content read.|
**Example** **Example**
...@@ -1491,9 +1491,9 @@ Synchronously reads the text of a file. ...@@ -1491,9 +1491,9 @@ Synchronously reads the text of a file.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------ | -------------------- | | ------ | -------------------- |
| string | Promise used to return the content of the file read.| | string | Promise used to return the content of the file read.|
**Example** **Example**
...@@ -1519,9 +1519,9 @@ Obtains link information. This API uses a promise to return the result. ...@@ -1519,9 +1519,9 @@ Obtains link information. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------- | ---------- | | ---------------------------- | ---------- |
| Promise&lt;[Stat](#stat)&gt; | Promise used to return the link information obtained. For details, see [Stat](#stat).| | Promise&lt;[Stat](#stat)&gt; | Promise used to return the link information obtained. For details, see [Stat](#stat).|
**Example** **Example**
...@@ -1576,9 +1576,9 @@ Synchronously obtains the link information. ...@@ -1576,9 +1576,9 @@ Synchronously obtains the link information.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------- | ---------- | | ------------- | ---------- |
| [Stat](#stat) | Link information obtained.| | [Stat](#stat) | Link information obtained.|
**Example** **Example**
...@@ -1605,9 +1605,9 @@ Renames a file. This API uses a promise to return the result. ...@@ -1605,9 +1605,9 @@ Renames a file. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1682,15 +1682,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ...@@ -1682,15 +1682,15 @@ Flushes data of a file to disk. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| fd | number | Yes | File descriptor of the file to flush.| | fd | number | Yes | File descriptor of the file to flush.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1715,10 +1715,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return ...@@ -1715,10 +1715,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | --------------- | | -------- | ------------------------- | ---- | --------------- |
| fd | number | Yes | File descriptor of the file to flush. | | fd | number | Yes | File descriptor of the file to flush. |
| 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**
...@@ -1741,9 +1741,9 @@ Flushes data of a file to disk in synchronous mode. ...@@ -1741,9 +1741,9 @@ Flushes data of a file to disk in synchronous mode.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| fd | number | Yes | File descriptor of the file to flush.| | fd | number | Yes | File descriptor of the file to flush.|
**Example** **Example**
...@@ -1764,15 +1764,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** ...@@ -1764,15 +1764,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. **
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| fd | number | Yes | File descriptor of the file to flush.| | fd | number | Yes | File descriptor of the file to flush.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1797,10 +1797,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return ...@@ -1797,10 +1797,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return
**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 data is synchronized in asynchronous mode.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file data is synchronized in asynchronous mode.|
**Example** **Example**
...@@ -1823,9 +1823,9 @@ Synchronizes data in a file in synchronous mode. ...@@ -1823,9 +1823,9 @@ Synchronizes data in a file in synchronous mode.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| fd | number | Yes | File descriptor of the file to flush.| | fd | number | Yes | File descriptor of the file to flush.|
**Example** **Example**
...@@ -1853,9 +1853,9 @@ Creates a symbolic link based on the file path. This API uses a promise to retur ...@@ -1853,9 +1853,9 @@ Creates a symbolic link based on the file path. This API uses a promise to retur
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -1939,9 +1939,9 @@ Changes the file owner based on the file path. This API uses a promise to return ...@@ -1939,9 +1939,9 @@ Changes the file owner based on the file path. This API uses a promise to return
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -2019,15 +2019,15 @@ Creates a temporary directory. This API uses a promise to return the result. ...@@ -2019,15 +2019,15 @@ Creates a temporary directory. This API uses a promise to return the result.
**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**
| Type | Description | | Type | Description |
| --------------------- | ---------- | | --------------------- | ---------- |
| Promise&lt;string&gt; | Promise used to return the unique directory generated.| | Promise&lt;string&gt; | Promise used to return the unique directory generated.|
**Example** **Example**
...@@ -2050,10 +2050,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return ...@@ -2050,10 +2050,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return
**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**
...@@ -2074,15 +2074,15 @@ Synchronously creates a temporary directory. ...@@ -2074,15 +2074,15 @@ Synchronously creates a temporary directory.
**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**
| Type | Description | | Type | Description |
| ------ | ---------- | | ------ | ---------- |
| string | Unique path generated.| | string | Unique path generated.|
**Example** **Example**
...@@ -2101,16 +2101,16 @@ Changes file permissions based on the file descriptor. This API uses a promise t ...@@ -2101,16 +2101,16 @@ Changes file permissions based on the file descriptor. This API uses a promise t
**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>- **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. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -2136,11 +2136,11 @@ Changes file permissions based on the file descriptor. This API uses an asynchro ...@@ -2136,11 +2136,11 @@ Changes file permissions based on the file descriptor. This API uses an asynchro
**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>- **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. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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&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**
...@@ -2164,10 +2164,10 @@ Synchronously changes the file permissions based on the file descriptor. ...@@ -2164,10 +2164,10 @@ Synchronously changes the file permissions based on the file descriptor.
**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>- **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. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (&#124;).<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** **Example**
...@@ -2196,9 +2196,9 @@ Opens a file stream based on the file path. This API uses a promise to return th ...@@ -2196,9 +2196,9 @@ Opens a file stream based on the file path. This API uses a promise to return th
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------------------- | --------- | | --------------------------------- | --------- |
| Promise&lt;[Stream](#stream)&gt; | Promise used to return the result.| | Promise&lt;[Stream](#stream)&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -2255,9 +2255,9 @@ Synchronously opens a stream based on the file path. ...@@ -2255,9 +2255,9 @@ Synchronously opens a stream based on the file path.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------ | --------- | | ------------------ | --------- |
| [Stream](#stream) | Stream opened.| | [Stream](#stream) | Stream opened.|
**Example** **Example**
...@@ -2277,16 +2277,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret ...@@ -2277,16 +2277,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret
**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 | - **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).| | 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** **Return value**
| Type | Description | | Type | Description |
| --------------------------------- | --------- | | --------------------------------- | --------- |
| Promise&lt;[Stream](#stream)&gt; | Promise used to return the result.| | Promise&lt;[Stream](#stream)&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -2311,11 +2311,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous ...@@ -2311,11 +2311,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous
**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 | - **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).| | 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&lt;[Stream](#stream)&gt; | Yes | Callback invoked when the stream is open asynchronously. | | callback | AsyncCallback&lt;[Stream](#stream)&gt; | Yes | Callback invoked when the stream is open asynchronously. |
**Example** **Example**
...@@ -2338,16 +2338,16 @@ Synchronously opens a stream based on the file descriptor. ...@@ -2338,16 +2338,16 @@ Synchronously opens a stream based on the file descriptor.
**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 | - **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).| | 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** **Return value**
| Type | Description | | Type | Description |
| ------------------ | --------- | | ------------------ | --------- |
| [Stream](#stream) | Stream opened.| | [Stream](#stream) | Stream opened.|
**Example** **Example**
...@@ -2368,17 +2368,17 @@ Changes the file owner based on the file descriptor. This API uses a promise to ...@@ -2368,17 +2368,17 @@ Changes the file owner based on the file descriptor. This API uses a promise to
**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 that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -2404,12 +2404,12 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono ...@@ -2404,12 +2404,12 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono
**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**
...@@ -2433,11 +2433,11 @@ Synchronously changes the file owner based on the file descriptor. ...@@ -2433,11 +2433,11 @@ Synchronously changes the file owner based on the file descriptor.
**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**
...@@ -2467,9 +2467,9 @@ Changes the file owner (owner of the symbolic link, not the file referred to by ...@@ -2467,9 +2467,9 @@ Changes the file owner (owner of the symbolic link, not the file referred to by
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ---------------------------- | | ------------------- | ---------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -2555,9 +2555,9 @@ Listens for file or directory changes. This API uses an asynchronous callback to ...@@ -2555,9 +2555,9 @@ Listens for file or directory changes. This API uses an asynchronous callback to
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------------- | ---------- | | -------------------- | ---------- |
| [Watcher](#watcher7) | Promise used to return the **Watcher** instance.| | [Watcher](#watcher7) | Promise used to return the **Watcher** instance.|
**Example** **Example**
...@@ -2617,9 +2617,9 @@ Checks whether this file is a block special file. A block special file supports ...@@ -2617,9 +2617,9 @@ Checks whether this file is a block special file. A block special file supports
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | ---------------- | | ------- | ---------------- |
| boolean | Whether the file is a block special file.| | boolean | Whether the file is a block special file.|
**Example** **Example**
...@@ -2639,9 +2639,9 @@ Checks whether this file is a character special file. A character special file s ...@@ -2639,9 +2639,9 @@ Checks whether this file is a character special file. A character special file s
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | ----------------- | | ------- | ----------------- |
| boolean | Whether the file is a character special file.| | boolean | Whether the file is a character special file.|
**Example** **Example**
...@@ -2661,9 +2661,9 @@ Checks whether this file is a directory. ...@@ -2661,9 +2661,9 @@ Checks whether this file is a directory.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | ------------- | | ------- | ------------- |
| boolean | Whether the file is a directory.| | boolean | Whether the file is a directory.|
**Example** **Example**
...@@ -2683,9 +2683,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int ...@@ -2683,9 +2683,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | --------------------- | | ------- | --------------------- |
| boolean | Whether the file is an FIFO.| | boolean | Whether the file is an FIFO.|
**Example** **Example**
...@@ -2705,9 +2705,9 @@ Checks whether this file is a regular file. ...@@ -2705,9 +2705,9 @@ Checks whether this file is a regular file.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | --------------- | | ------- | --------------- |
| boolean | Whether the file is a regular file.| | boolean | Whether the file is a regular file.|
**Example** **Example**
...@@ -2727,9 +2727,9 @@ Checks whether this file is a socket. ...@@ -2727,9 +2727,9 @@ Checks whether this file is a socket.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | -------------- | | ------- | -------------- |
| boolean | Whether the file is a socket.| | boolean | Whether the file is a socket.|
**Example** **Example**
...@@ -2749,9 +2749,9 @@ Checks whether this file is a symbolic link. ...@@ -2749,9 +2749,9 @@ Checks whether this file is a symbolic link.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------- | --------------- | | ------- | --------------- |
| boolean | Whether the file is a symbolic link.| | boolean | Whether the file is a symbolic link.|
**Example** **Example**
...@@ -2797,9 +2797,9 @@ Stops the **watcher** instance. This API uses an asynchronous callback to return ...@@ -2797,9 +2797,9 @@ Stops the **watcher** instance. This API uses an asynchronous callback to return
**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**
...@@ -2829,9 +2829,9 @@ Closes the stream. This API uses a promise to return the result. ...@@ -2829,9 +2829,9 @@ Closes the stream. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------- | | ------------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the stream close result.| | Promise&lt;void&gt; | Promise used to return the stream close result.|
**Example** **Example**
...@@ -2856,9 +2856,9 @@ Closes the stream. This API uses an asynchronous callback to return the result. ...@@ -2856,9 +2856,9 @@ Closes the stream. This API uses an asynchronous callback to return the result.
**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**
...@@ -2898,9 +2898,9 @@ Flushes the stream. This API uses a promise to return the result. ...@@ -2898,9 +2898,9 @@ Flushes the stream. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------- | | ------------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the stream flushing result.| | Promise&lt;void&gt; | Promise used to return the stream flushing result.|
**Example** **Example**
...@@ -2925,9 +2925,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result. ...@@ -2925,9 +2925,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | -------------- | | -------- | ------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the stream is asynchronously flushed.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the stream is asynchronously flushed.|
**Example** **Example**
...@@ -2967,16 +2967,16 @@ Writes data into the stream. This API uses a promise to return the result. ...@@ -2967,16 +2967,16 @@ Writes data into the stream. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------------------------------------- | | ------- | ------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size |
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | -------- | | --------------------- | -------- |
| Promise&lt;number&gt; | Promise used to return the length of the data written.| | Promise&lt;number&gt; | Promise used to return the length of the data written.|
**Example** **Example**
...@@ -3001,11 +3001,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th ...@@ -3001,11 +3001,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size| | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size|
| 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**
...@@ -3031,16 +3031,16 @@ Synchronously writes data into the stream. ...@@ -3031,16 +3031,16 @@ Synchronously writes data into the stream.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------------------------------------- | | ------- | ------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size | | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.<br>Constraints: offset + length <= Buffer size |
**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**
...@@ -3061,16 +3061,16 @@ Reads data from the stream. This API uses a promise to return the result. ...@@ -3061,16 +3061,16 @@ Reads data from the stream. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ----------- | ---- | ---------------------------------------- | | ------- | ----------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | | 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 | | 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** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | ------ | | ---------------------------------- | ------ |
| Promise&lt;[ReadOut](#readout)&gt; | Promise used to return the data read.| | Promise&lt;[ReadOut](#readout)&gt; | Promise used to return the data read.|
**Example** **Example**
...@@ -3096,11 +3096,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the ...@@ -3096,11 +3096,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | | 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 | | 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&lt;[ReadOut](#readout)&gt; | Yes | Callback invoked when data is read asynchronously from the stream. | | callback | AsyncCallback&lt;[ReadOut](#readout)&gt; | Yes | Callback invoked when data is read asynchronously from the stream. |
**Example** **Example**
...@@ -3126,16 +3126,16 @@ Synchronously reads data from the stream. ...@@ -3126,16 +3126,16 @@ Synchronously reads data from the stream.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ----------- | ---- | ---------------------------------------- | | ------- | ----------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | | 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 | | 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** **Return value**
| Type | Description | | Type | Description |
| ------ | -------- | | ------ | -------- |
| number | Length of the data read.| | number | Length of the data read.|
**Example** **Example**
...@@ -3161,9 +3161,9 @@ Reads the next directory entry. This API uses a promise to return the result. ...@@ -3161,9 +3161,9 @@ Reads the next directory entry. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------------------------- | ------------- | | -------------------------------- | ------------- |
| Promise&lt;[Dirent](#dirent)&gt; | Promise used to return the directory entry read.| | Promise&lt;[Dirent](#dirent)&gt; | Promise used to return the directory entry read.|
**Example** **Example**
...@@ -3186,9 +3186,9 @@ Reads the next directory entry. This API uses an asynchronous callback to return ...@@ -3186,9 +3186,9 @@ Reads the next directory entry. This API uses an asynchronous callback to return
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | ---- | ---------------- | | -------- | -------------------------------------- | ---- | ---------------- |
| callback | AsyncCallback&lt;[Dirent](#dirent)&gt; | Yes | Callback invoked when the next directory entry is asynchronously read.| | callback | AsyncCallback&lt;[Dirent](#dirent)&gt; | Yes | Callback invoked when the next directory entry is asynchronously read.|
**Example** **Example**
...@@ -3212,9 +3212,9 @@ Synchronously reads the next directory entry. ...@@ -3212,9 +3212,9 @@ Synchronously reads the next directory entry.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------- | -------- | | ----------------- | -------- |
| [Dirent](#dirent) | Directory entry read.| | [Dirent](#dirent) | Directory entry read.|
**Example** **Example**
...@@ -3295,9 +3295,9 @@ Checks whether this directory entry is a block special file. A block special fil ...@@ -3295,9 +3295,9 @@ Checks whether this directory entry is a block special file. A block special fil
**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**
...@@ -3317,9 +3317,9 @@ Checks whether a directory entry is a character special file. A character specia ...@@ -3317,9 +3317,9 @@ Checks whether a directory entry is a character special file. A character specia
**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**
...@@ -3339,9 +3339,9 @@ Checks whether a directory entry is a directory. ...@@ -3339,9 +3339,9 @@ Checks whether a directory entry is a directory.
**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**
...@@ -3361,9 +3361,9 @@ Checks whether this directory entry is a named pipe (or FIFO). Named pipes are u ...@@ -3361,9 +3361,9 @@ Checks whether this directory entry is a named pipe (or FIFO). Named pipes are u
**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**
...@@ -3383,9 +3383,9 @@ Checks whether a directory entry is a regular file. ...@@ -3383,9 +3383,9 @@ Checks whether a directory entry is a regular file.
**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**
...@@ -3405,9 +3405,9 @@ Checks whether a directory entry is a socket. ...@@ -3405,9 +3405,9 @@ Checks whether a directory entry is a socket.
**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**
...@@ -3427,9 +3427,9 @@ Checks whether a directory entry is a symbolic link. ...@@ -3427,9 +3427,9 @@ Checks whether a directory entry is a symbolic link.
**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**
......
...@@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result. ...@@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result.
| -------- | --------------------------- | ---- | --------------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Alias of the key. | | keyAlias | string | Yes | Alias of the key. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. The algorithm, key purpose, and key length are mandatory.| | options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. The algorithm, key purpose, and key length are mandatory.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If no error is captured, the key is successfully generated. In this case, the API does not return the key content because the key is always protected in a TEE. If an error is captured, an exception occurs in the generation process.|
**Example** **Example**
...@@ -121,7 +121,7 @@ try { ...@@ -121,7 +121,7 @@ try {
generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void> generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>
Generates a key. This API uses a promise to return the result. Generates a key. This API uses a promise to return the result. Because the key is always protected in an trusted environment (such as a TEE), the promise does not return the key content. It returns only the information indicating whether the API is successfully called.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
...@@ -1084,7 +1084,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th ...@@ -1084,7 +1084,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th
| -------- | --------------------------- | ---- | --------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------- |
| keyAlias | string | Yes | Alias of the key to check. | | keyAlias | string | Yes | Alias of the key to check. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.| | callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the key exists, **data** is **true**. If the key does not exist, **error** is the error code.|
**Example** **Example**
...@@ -1094,17 +1094,19 @@ let keyAlias = 'keyAlias'; ...@@ -1094,17 +1094,19 @@ let keyAlias = 'keyAlias';
let emptyOptions = { let emptyOptions = {
properties: [] properties: []
}; };
try { huks.isKeyItemExist(keyAlias, emptyOptions, function (error, data) {
huks.isKeyItemExist(keyAlias, emptyOptions, function (error, data) { if (data) {
if (error) { promptAction.showToast({
console.error(`callback: isKeyItemExist failed, code: ${error.code}, msg: ${error.message}`); message: "keyAlias: " + keyAlias +"is existed! ",
duration: 2500,
})
} else { } else {
console.info(`callback: isKeyItemExist success, data = ${JSON.stringify(data)}`); promptAction.showToast({
message: "find key failed, error code: " + error.code + " error msg: " + error.message,
duration: 2500,
})
} }
}); });
} catch (error) {
console.error(`promise: isKeyItemExist input arg invalid, code: ${error.code}, msg: ${error.message}`);
}
``` ```
## huks.isKeyItemExist<sup>9+</sup> ## huks.isKeyItemExist<sup>9+</sup>
...@@ -1126,7 +1128,7 @@ Checks whether a key exists. This API uses a promise to return the result. ...@@ -1126,7 +1128,7 @@ Checks whether a key exists. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ----------------- | --------------------------------------- | | ----------------- | --------------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.| | Promise\<boolean> | Promise used to return the result. If the key exists, then() performs subsequent operations. If the key does not exist, error() performs the related service operations.|
**Example** **Example**
...@@ -1136,17 +1138,17 @@ let keyAlias = 'keyAlias'; ...@@ -1136,17 +1138,17 @@ let keyAlias = 'keyAlias';
let emptyOptions = { let emptyOptions = {
properties: [] properties: []
}; };
try { await huks.isKeyItemExist(keyAlias, emptyOptions).then((data) => {
huks.isKeyItemExist(keyAlias, emptyOptions) promptAction.showToast({
.then ((data) => { message: "keyAlias: " + keyAlias +"is existed! ",
console.info(`promise: isKeyItemExist success, data = ${JSON.stringify(data)}`); duration: 500,
})
}).catch((err)=>{
promptAction.showToast({
message: "find key failed, error code: " + err.code + " error message: " + err.message,
duration: 6500,
})
}) })
.catch(error => {
console.error(`promise: isKeyItemExist failed, code: ${error.code}, msg: ${error.message}`);
});
} catch (error) {
console.error(`promise: isKeyItemExist input arg invalid, code: ${error.code}, msg: ${error.message}`);
}
``` ```
## huks.initSession<sup>9+</sup> ## huks.initSession<sup>9+</sup>
...@@ -1257,7 +1259,7 @@ Completes the key operation and releases resources. This API uses an asynchronou ...@@ -1257,7 +1259,7 @@ Completes the key operation and releases resources. This API uses an asynchronou
| handle | number | Yes | Handle for the **finishSession** operation. | | handle | number | Yes | Handle for the **finishSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
| token | Uint8Array | Yes | Token of the **finishSession** operation. | | token | Uint8Array | Yes | Token of the **finishSession** operation. |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. | | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result.|
## huks.finishSession<sup>9+</sup> ## huks.finishSession<sup>9+</sup>
...@@ -1274,7 +1276,7 @@ Completes the key operation and releases resources. This API uses an asynchronou ...@@ -1274,7 +1276,7 @@ Completes the key operation and releases resources. This API uses an asynchronou
| handle | number | Yes | Handle for the **finishSession** operation. | | handle | number | Yes | Handle for the **finishSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
| token | Uint8Array | Yes | Token of the **finishSession** operation. | | token | Uint8Array | Yes | Token of the **finishSession** operation. |
| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. | | callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result.|
## huks.finishSession<sup>9+</sup> ## huks.finishSession<sup>9+</sup>
...@@ -1890,7 +1892,7 @@ Enumerates the tags used to invoke parameters. ...@@ -1890,7 +1892,7 @@ Enumerates the tags used to invoke parameters.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
| Name | Value | Description | | Name | Value | Description |
| -------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------ | | -------------------------------------------- | ---------------------------------------- | -------------------------------------- |
| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. | | HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. |
| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | Algorithm. | | HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | Algorithm. |
| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. | | HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. |
...@@ -1918,20 +1920,20 @@ Enumerates the tags used to invoke parameters. ...@@ -1918,20 +1920,20 @@ Enumerates the tags used to invoke parameters.
| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | Size of the derived key. | | HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | Size of the derived key. |
| HUKS_TAG_IMPORT_KEY_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | Type of the imported key. | | HUKS_TAG_IMPORT_KEY_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | Type of the imported key. |
| HUKS_TAG_UNWRAP_ALGORITHM_SUITE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | Algorithm suite required for encrypted imports. | | HUKS_TAG_UNWRAP_ALGORITHM_SUITE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | Algorithm suite required for encrypted imports. |
| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | Reserved. | | HUKS_TAG_ACTIVE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | Parameter originally reserved for certificate management. It is deprecated because certificate management is no longer implemented in this module. |
| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Reserved. | | HUKS_TAG_ORIGINATION_EXPIRE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Parameter originally reserved for certificate management. It is deprecated because certificate management is no longer implemented in this module. |
| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Reserved. | | HUKS_TAG_USAGE_EXPIRE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Parameter originally reserved for certificate management. It is deprecated because certificate management is no longer implemented in this module. |
| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | Reserved. | | HUKS_TAG_CREATION_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | Parameter originally reserved for certificate management. It is deprecated because certificate management is no longer implemented in this module. |
| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. | | HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. |
| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | Reserved. | | HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | ID of the user to which the key belongs. |
| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. | | HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. |
| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE**. | | HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE\**.| HKS_USER_AUTH_TYPE_FINGERPRINT |
| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. | | HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Timeout period of an authentication token. |
| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. | | HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Used to pass in the authentication token. |
| HUKS_TAG_KEY_AUTH_ACCESS_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | Access control type. For details, see [HuksAuthAccessType](#huksauthaccesstype9). This parameter must be set together with [HuksUserAuthType](#huksuserauthtype9). | | HUKS_TAG_KEY_AUTH_ACCESS_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | Access control type. For details, see [HuksAuthAccessType](#huksauthaccesstype9). This parameter must be set together with [HuksUserAuthType](#huksuserauthtype9).|
| HUKS_TAG_KEY_SECURE_SIGN_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported. | | HUKS_TAG_KEY_SECURE_SIGN_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported.|
| HUKS_TAG_CHALLENGE_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9). | | HUKS_TAG_CHALLENGE_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9).|
| HUKS_TAG_CHALLENGE_POS<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | Position of the 8-byte valid value in a custom challenge. For details, see [HuksChallengePosition](#hukschallengeposition9). | | HUKS_TAG_CHALLENGE_POS<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | Position of the 8-byte valid value in a custom challenge. For details, see [HuksChallengePosition](#hukschallengeposition9).|
| HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | Challenge value used in the attestation. | | HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | Challenge value used in the attestation. |
| HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | Application ID used in the attestation. | | HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | Application ID used in the attestation. |
| HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | Brand of the device. | | HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | Brand of the device. |
...@@ -1947,7 +1949,7 @@ Enumerates the tags used to invoke parameters. ...@@ -1947,7 +1949,7 @@ Enumerates the tags used to invoke parameters.
| HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Unique device identifier (UDID) of the device. | | HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Unique device identifier (UDID) of the device. |
| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security level used in the attestation. | | HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security level used in the attestation. |
| HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | Version information used in the attestation. | | HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | Version information used in the attestation. |
| HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Whether to use the alias passed in during key generation. | | HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Whether to use the alias passed in during key generation.|
| HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | Key storage mode. | | HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | Key storage mode. |
| HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. | | HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. |
| HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. | | HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. |
...@@ -1966,7 +1968,7 @@ Enumerates the tags used to invoke parameters. ...@@ -1966,7 +1968,7 @@ Enumerates the tags used to invoke parameters.
| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | Reserved. | | HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | Reserved. |
| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | Key version. | | HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | Key version. |
| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | Reserved. | | HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | Reserved. |
| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | Reserved. | | HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | Used to pass in the AEAD in GCM mode. |
| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | Reserved. | | HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | Reserved. |
| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | OS version. | | HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | OS version. |
| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | OS patch level. | | HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | OS patch level. |
...@@ -2285,7 +2287,7 @@ Exports a key. This API uses an asynchronous callback to return the result. ...@@ -2285,7 +2287,7 @@ Exports a key. This API uses an asynchronous callback to return the result.
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. | | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.|
**Example** **Example**
...@@ -2319,7 +2321,7 @@ Exports a key. This API uses a promise to return the result. ...@@ -2319,7 +2321,7 @@ Exports a key. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ----------------------------------- | ------------------------------------------------------------ | | ----------------------------------- | ------------------------------------------------------------ |
| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. | | Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.|
**Example** **Example**
...@@ -2516,7 +2518,7 @@ Updates the key operation by segment. This API uses an asynchronous callback to ...@@ -2516,7 +2518,7 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| handle | number | Yes | Handle for the **update** operation. | | handle | number | Yes | Handle for the **update** operation. |
| token | Uint8Array | No | Token of the **update** operation. | | token | Uint8Array | No | Token of the **update** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. |
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the **update** operation result. | | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the **update** operation result.|
## huks.update<sup>(deprecated)</sup> ## huks.update<sup>(deprecated)</sup>
...@@ -2540,7 +2542,7 @@ Updates the key operation by segment. This API uses a promise to return the resu ...@@ -2540,7 +2542,7 @@ Updates the key operation by segment. This API uses a promise to return the resu
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **update** operation result. | | Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **update** operation result.|
## huks.finish<sup>(deprecated)</sup> ## huks.finish<sup>(deprecated)</sup>
...@@ -2599,7 +2601,7 @@ Aborts the use of the key. This API uses an asynchronous callback to return the ...@@ -2599,7 +2601,7 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| handle | number | Yes | Handle for the **abort** operation.| | handle | number | Yes | Handle for the **abort** operation.|
| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.|
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **abort** operation result. | | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **abort** operation result.|
**Example** **Example**
...@@ -2821,6 +2823,7 @@ function huksAbort() { ...@@ -2821,6 +2823,7 @@ function huksAbort() {
Defines the HUKS handle structure. Defines the HUKS handle structure.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [HuksSessionHandle<sup>9+</sup>](#hukssessionhandle9).
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------- | ---- | -------- | | ---------- | ---------------- | ---- | -------- |
...@@ -2834,6 +2837,8 @@ Defines the **HuksResult** structure. ...@@ -2834,6 +2837,8 @@ Defines the **HuksResult** structure.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [HuksReturnResult<sup>9+</sup>](#huksreturnresult9).
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------- | ---- | ---------------- | | ---------- | ------------------------------- | ---- | ---------------- |
| errorCode | number | Yes | Error code. | | errorCode | number | Yes | Error code. |
...@@ -2847,6 +2852,7 @@ Defines the **HuksResult** structure. ...@@ -2847,6 +2852,7 @@ Defines the **HuksResult** structure.
Enumerates the error codes. Enumerates the error codes.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use HuksExceptionErrCode<sup>9+</sup>](#huksexceptionerrcode9).
| Name | Value | Description| | Name | Value | Description|
| -------------------------- | ----- | ---- | | -------------------------- | ----- | ---- |
......
...@@ -4441,7 +4441,9 @@ Authenticates a domain account. ...@@ -4441,7 +4441,9 @@ Authenticates a domain account.
getAccountInfo: (domain, accountName, callback) => {}, getAccountInfo: (domain, accountName, callback) => {},
getAuthStatusInfo: (domainAccountInfo, callback) => {}, getAuthStatusInfo: (domainAccountInfo, callback) => {},
bindAccount: (domainAccountInfo, localId, callback) => {}, bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {} unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin); account_osAccount.DomainAccountManager.registerPlugin(plugin);
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
...@@ -4494,7 +4496,9 @@ Authenticates a domain account in a pop-up window. ...@@ -4494,7 +4496,9 @@ Authenticates a domain account in a pop-up window.
getAccountInfo: (domain, accountName, callback) => {}, getAccountInfo: (domain, accountName, callback) => {},
getAuthStatusInfo: (domainAccountInfo, callback) => {}, getAuthStatusInfo: (domainAccountInfo, callback) => {},
bindAccount: (domainAccountInfo, localId, callback) => {}, bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {} unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin) account_osAccount.DomainAccountManager.registerPlugin(plugin)
``` ```
...@@ -4534,7 +4538,9 @@ Authenticates a domain account by the authorization token. ...@@ -4534,7 +4538,9 @@ Authenticates a domain account by the authorization token.
getAccountInfo: (domain, accountName, callback) => {}, getAccountInfo: (domain, accountName, callback) => {},
getAuthStatusInfo: (domainAccountInfo, callback) => {}, getAuthStatusInfo: (domainAccountInfo, callback) => {},
bindAccount: (domainAccountInfo, localId, callback) => {}, bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {} unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin) account_osAccount.DomainAccountManager.registerPlugin(plugin)
``` ```
...@@ -4576,7 +4582,9 @@ Obtains information about a domain account. ...@@ -4576,7 +4582,9 @@ Obtains information about a domain account.
}, },
getAuthStatusInfo: (domainAccountInfo, callback) => {}, getAuthStatusInfo: (domainAccountInfo, callback) => {},
bindAccount: (domainAccountInfo, localId, callback) => {}, bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {} unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin) account_osAccount.DomainAccountManager.registerPlugin(plugin)
``` ```
...@@ -4614,7 +4622,9 @@ Obtains the authentication status of a domain account. ...@@ -4614,7 +4622,9 @@ Obtains the authentication status of a domain account.
}) })
}, },
bindAccount: (domainAccountInfo, localId, callback) => {}, bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {} unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin) account_osAccount.DomainAccountManager.registerPlugin(plugin)
``` ```
...@@ -4649,7 +4659,9 @@ Binds a domain account. ...@@ -4649,7 +4659,9 @@ Binds a domain account.
// notify binding result // notify binding result
callback({code: 0}) callback({code: 0})
}, },
unbindAccount: (domainAccountInfo, callback) => {} unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin) account_osAccount.DomainAccountManager.registerPlugin(plugin)
``` ```
...@@ -4684,6 +4696,84 @@ Unbinds a domain account. ...@@ -4684,6 +4696,84 @@ Unbinds a domain account.
// mock unbinding operation // mock unbinding operation
// notify unbinding result // notify unbinding result
callback({code: 0}) callback({code: 0})
},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {}
}
account_osAccount.DomainAccountManager.registerPlugin(plugin)
```
### isAccountTokenValid<sup>10+</sup>
isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: AsyncCallback&lt;boolean&gt;): void
Checks whether a domain account token is valid.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | --------------- |
| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.|
| token | Uint8Array | Yes| Domain account token to check.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result.|
**Example**
```js
let plugin = {
auth: (domainAccountInfo, credential, callback) => {},
authWithPopup: (domainAccountInfo, callback) => {},
authWithToken: (domainAccountInfo, callback) => {},
getAccountInfo: (domain, accountName, callback) => {},
getAuthStatusInfo: (domainAccountInfo, callback) => {},
bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {
// mock checking operation
// notify checking result
callback({code: 0}, true);
},
getAccessToken: (options, callback) => {}
}
account_osAccount.DomainAccountManager.registerPlugin(plugin)
```
### getAccessToken<sup>10+</sup>
getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the domain access token based on the specified conditions.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | --------------- |
| options | [GetDomainAccessTokenOptions](#getdomainaccesstokenoptions10) | Yes | Options specified for obtaining the domain access token.|
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback invoked to return the result.|
**Example**
```js
let plugin = {
auth: (domainAccountInfo, credential, callback) => {},
authWithPopup: (domainAccountInfo, callback) => {},
authWithToken: (domainAccountInfo, callback) => {},
getAccountInfo: (domain, accountName, callback) => {},
getAuthStatusInfo: (domainAccountInfo, callback) => {},
bindAccount: (domainAccountInfo, localId, callback) => {},
unbindAccount: (domainAccountInfo, callback) => {},
isAccountTokenValid: (domainAccountInfo, callback) => {},
getAccessToken: (options, callback) => {
// mock getting operation
let token = new Uint8Array([0]);
// notify result
callback({code: 0}, token);
} }
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin) account_osAccount.DomainAccountManager.registerPlugin(plugin)
...@@ -5003,6 +5093,107 @@ Checks whether a domain account exists. ...@@ -5003,6 +5093,107 @@ Checks whether a domain account exists.
} }
``` ```
### updateAccountToken<sup>10+</sup>
updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: AsyncCallback&lt;void&gt;): void;
Updates the token of a domain account. An empty token means an invalid token. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | --------------- |
| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.|
| token | Uint8Array | Yes | New token of the domain account.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the token is successfully updated, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
| ID| Error Message |
| -------- | --------------------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid token. |
| 12300003 | Account not found. |
**Example**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan",
accountId: "123456"
}
let token = new Uint8Array([0])
try {
account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token, (err) => {
if (err != null) {
console.log("updateAccountToken failed, error: " + JSON.stringify(err));
} else {
console.log("updateAccountToken successfully");
}
})
} catch (err) {
console.log('updateAccountToken exception = ' + JSON.stringify(err));
}
```
### updateAccountToken<sup>10+</sup>
updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Promise&lt;void&gt;
Updates the token of a domain account. An empty token means an invalid token. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | --------------- |
| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.|
| token | Uint8Array | Yes | New token of the domain account.|
**Return value**
| Type | Description |
| :------------------------ | ----------------------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
| ID| Error Message |
| -------- | --------------------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid token. |
| 12300003 | Account not found. |
**Example**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan",
accountId: "123456"
}
let token = new Uint8Array([0])
try {
account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token).then(() => {
console.log("updateAccountToken successfully");
}).catch((err) => {
console.log("updateAccountToken failed, error: " + JSON.stringify(err));
});
} catch (err) {
console.log('updateAccountToken exception = ' + JSON.stringify(err));
}
```
## UserIdentityManager<sup>8+</sup> ## UserIdentityManager<sup>8+</sup>
Provides APIs for user identity management (IDM). Provides APIs for user identity management (IDM).
...@@ -5956,7 +6147,7 @@ Defines the OS account information. ...@@ -5956,7 +6147,7 @@ Defines the OS account information.
| localName | string | Yes | OS account name. | | localName | string | Yes | OS account name. |
| type | [OsAccountType](#osaccounttype) | Yes | OS account type. | | type | [OsAccountType](#osaccounttype) | Yes | OS account type. |
| constraints | Array&lt;string&gt; | No | [Constraints](#constraints) on the OS account.| | constraints | Array&lt;string&gt; | No | [Constraints](#constraints) on the OS account.|
| isVerified<sup>8+</sup> | boolean | Yes | Whether the OS account is verified. | | isVerified<sup>8+</sup> | boolean | Yes | Whether to verify the OS account. |
| photo<sup>8+</sup> | string | No | Profile photo of the OS account. | | photo<sup>8+</sup> | string | No | Profile photo of the OS account. |
| createTime<sup>8+</sup> | number | Yes | Time when the OS account was created. | | createTime<sup>8+</sup> | number | Yes | Time when the OS account was created. |
| lastLoginTime<sup>8+</sup> | number | No | Last login time of the OS account. | | lastLoginTime<sup>8+</sup> | number | No | Last login time of the OS account. |
...@@ -6086,3 +6277,18 @@ Presents the authentication status information. ...@@ -6086,3 +6277,18 @@ Presents the authentication status information.
| ----------- | ------ | ---- | ---------- | | ----------- | ------ | ---- | ---------- |
| remainTimes | number | Yes | Number of remaining authentication times. | | remainTimes | number | Yes | Number of remaining authentication times. |
| freezingTime | number | Yes | Freezing time.| | freezingTime | number | Yes | Freezing time.|
## GetDomainAccessTokenOptions<sup>10+</sup>
Defines the options for obtaining a domain access token.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ---------- |
| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information. |
| domainAccountToken | Uint8Array | Yes | Token of the domain account.|
| businessParams | { [key: string]: object } | Yes | Service parameters customized by the service party based on the request protocol.|
| callerUid | number | Yes | Unique identifier of the caller.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册