提交 85327156 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 9e325ef8
...@@ -64,7 +64,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -64,7 +64,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example** **Example**
...@@ -111,7 +111,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -111,7 +111,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example** **Example**
...@@ -154,7 +154,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -154,7 +154,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. | | 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. | | 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -206,7 +206,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -206,7 +206,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | TokenId does not exist. | | 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. | | 12100003 | Permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -265,7 +265,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -265,7 +265,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. | | 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. | | 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -317,7 +317,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -317,7 +317,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | TokenId does not exist. | | 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. | | 12100003 | Permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -375,7 +375,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -375,7 +375,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100002 | The specified tokenID does not exist. | | 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. | | 12100003 | The specified permission does not exist. |
| 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. | | 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. |
...@@ -452,7 +452,7 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -452,7 +452,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100004 | The interface is called repeatedly with the same input. | | 12100004 | The interface is called repeatedly with the same input. |
| 12100005 | The registration time has exceeded the limitation. | | 12100005 | The registration time has exceeded the limitation. |
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
...@@ -462,10 +462,10 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -462,10 +462,10 @@ For details about the error codes, see [Application Access Control Error Codes](
```js ```js
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId]; let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"]; let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try { try {
...@@ -513,10 +513,10 @@ For details about the error codes, see [Application Access Control Error Codes]( ...@@ -513,10 +513,10 @@ For details about the error codes, see [Application Access Control Error Codes](
```js ```js
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId]; let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"]; let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try { try {
...@@ -543,7 +543,7 @@ Verifies whether a permission is granted to an application. This API uses a prom ...@@ -543,7 +543,7 @@ Verifies whether a permission is granted to an application. This API uses a prom
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------ | | -------- | ------------------- | ---- | ------------------------------------------ |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | | permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value** **Return value**
...@@ -568,7 +568,10 @@ promise.then(data => { ...@@ -568,7 +568,10 @@ promise.then(data => {
requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;, requestCallback: AsyncCallback&lt;PermissionRequestResult&gt;) : void; requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;, requestCallback: AsyncCallback&lt;PermissionRequestResult&gt;) : void;
Requests permissions from the user in a dialog box. This API uses an asynchronous callback to return the result. Requests user authorization in a dialog box opened by a UIAbility. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The API cannot be called by any non-UIAbility.
**Model restriction**: This API can be used only in the stage model. **Model restriction**: This API can be used only in the stage model.
...@@ -578,7 +581,7 @@ Requests permissions from the user in a dialog box. This API uses an asynchronou ...@@ -578,7 +581,7 @@ Requests permissions from the user in a dialog box. This API uses an asynchronou
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. | | context | Context | Yes| Context of the UIAbility.|
| permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| | permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback invoked to return the result.| | callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback invoked to return the result.|
...@@ -610,7 +613,11 @@ try { ...@@ -610,7 +613,11 @@ try {
requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;) : Promise&lt;PermissionRequestResult&gt;; requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permissions&gt;) : Promise&lt;PermissionRequestResult&gt;;
Requests permissions from the user in a dialog box. This API uses a promise to return the result. Requests user authorization in a dialog box opened by a UIAbility. This API uses a promise to return the result.
> **NOTE**
>
> The API cannot be called by any non-UIAbility.
**Model restriction**: This API can be used only in the stage model. **Model restriction**: This API can be used only in the stage model.
...@@ -620,7 +627,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to ...@@ -620,7 +627,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. | | context | Context | Yes| Context of the UIAbility.|
| permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| | permissionList | Array&lt;Permissions&gt; | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value** **Return value**
...@@ -672,7 +679,7 @@ Verifies whether a permission is granted to an application. This API uses a prom ...@@ -672,7 +679,7 @@ Verifies whether a permission is granted to an application. This API uses a prom
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------ | | -------- | ------------------- | ---- | ------------------------------------------ |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | string | Yes | Permission to check.| | permissionName | string | Yes | Permission to verify.|
**Return value** **Return value**
...@@ -730,4 +737,3 @@ Defines detailed information about the permission grant state change. ...@@ -730,4 +737,3 @@ Defines detailed information about the permission grant state change.
| change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. | | change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. |
| tokenID | number | Yes | No | Token ID of the application. | | tokenID | number | Yes | No | Token ID of the application. |
| permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | | permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). |
...@@ -903,7 +903,7 @@ Sets custom data for an app account. This API uses an asynchronous callback to r ...@@ -903,7 +903,7 @@ Sets custom data for an app account. This API uses an asynchronous callback to r
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or key or value. | | 12300002 | Invalid name, key, or value. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400003 | The number of custom data reaches the upper limit. | | 12400003 | The number of custom data reaches the upper limit. |
...@@ -950,7 +950,7 @@ Sets custom data for an app account. This API uses a promise to return the resul ...@@ -950,7 +950,7 @@ Sets custom data for an app account. This API uses a promise to return the resul
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or key or value. | | 12300002 | Invalid name, key, or value. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400003 | The number of custom data reaches the upper limit. | | 12400003 | The number of custom data reaches the upper limit. |
...@@ -1347,7 +1347,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t ...@@ -1347,7 +1347,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType. | | 12300002 | Invalid name, owner, or authType. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -1410,7 +1410,7 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -1410,7 +1410,7 @@ Authenticates an app account with customized options. This API uses an asynchron
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType. | | 12300002 | Invalid name, owner, authType, or options. |
| 12300003 | Account not exist. | | 12300003 | Account not exist. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -1522,7 +1522,7 @@ Obtains the authorization token of the specified authentication type for an app ...@@ -1522,7 +1522,7 @@ Obtains the authorization token of the specified authentication type for an app
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType. | | 12300002 | Invalid name, owner, or authType. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
...@@ -1562,7 +1562,7 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -1562,7 +1562,7 @@ Sets an authorization token of the specific authentication type for an app accou
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or token. | | 12300002 | Invalid name, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. | | 12400004 | The number of token reaches the upper limit. |
...@@ -1609,7 +1609,7 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -1609,7 +1609,7 @@ Sets an authorization token of the specific authentication type for an app accou
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or token. | | 12300002 | Invalid name, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. | | 12400004 | The number of token reaches the upper limit. |
...@@ -1650,7 +1650,7 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -1650,7 +1650,7 @@ Deletes the authorization token of the specified authentication type for an app
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType or token. | | 12300002 | Invalid name, owner, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
...@@ -1698,7 +1698,7 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -1698,7 +1698,7 @@ Deletes the authorization token of the specified authentication type for an app
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or authType or token. | | 12300002 | Invalid name, owner, authType, or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
...@@ -1739,7 +1739,7 @@ Sets the visibility of an authorization token to an app. This API uses an asynch ...@@ -1739,7 +1739,7 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -1789,7 +1789,7 @@ Sets the visibility of an authorization token to an app. This API uses a promise ...@@ -1789,7 +1789,7 @@ Sets the visibility of an authorization token to an app. This API uses a promise
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -1831,7 +1831,7 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -1831,7 +1831,7 @@ Checks the visibility of an authorization token of the specified authentication
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -1879,7 +1879,7 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -1879,7 +1879,7 @@ Checks the visibility of an authorization token of the specified authentication
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or authType or bundleName. | | 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300107 | AuthType not found. | | 12300107 | AuthType not found. |
| 12400001 | Application not found. | | 12400001 | Application not found. |
...@@ -2092,12 +2092,14 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2092,12 +2092,14 @@ Obtains the authenticator callback for the authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant((err, want) => {
export default class EntryAbility extends UIAbility {
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try { try {
appAccountManager.getAuthCallback(sessionId, (err, callback) => { appAccountManager.getAuthCallback(sessionId, (err, callback) => {
if (err.code != account_appAccount.ResultCode.SUCCESS) { if (err != null) {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log("getAuthCallback err: " + JSON.stringify(err));
return; return;
} }
...@@ -2111,12 +2113,13 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2111,12 +2113,13 @@ Obtains the authenticator callback for the authentication session. This API uses
authType: "getSocialData" authType: "getSocialData"
} }
}; };
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(0, result);
}); });
} catch (err) { } catch (err) {
console.log("getAuthCallback exception: " + JSON.stringify(err)); console.log("getAuthCallback exception: " + JSON.stringify(err));
} }
}); }
}
``` ```
### getAuthCallback<sup>9+</sup> ### getAuthCallback<sup>9+</sup>
...@@ -2150,9 +2153,10 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2150,9 +2153,10 @@ Obtains the authenticator callback for the authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant().then((want) => { export default class EntryAbility extends UIAbility {
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try { try {
appAccountManager.getAuthCallback(sessionId).then((callback) => { appAccountManager.getAuthCallback(sessionId).then((callback) => {
...@@ -2166,16 +2170,15 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2166,16 +2170,15 @@ Obtains the authenticator callback for the authentication session. This API uses
authType: "getSocialData" authType: "getSocialData"
} }
}; };
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(0, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log("getAuthCallback err: " + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getAuthCallback exception: " + JSON.stringify(err)); console.log("getAuthCallback exception: " + JSON.stringify(err));
} }
}).catch((err) => { }
console.log("getWant err: " + JSON.stringify(err)); }
});
``` ```
### queryAuthenticatorInfo<sup>9+</sup> ### queryAuthenticatorInfo<sup>9+</sup>
...@@ -2281,7 +2284,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous ...@@ -2281,7 +2284,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or labels. | | 12300002 | Invalid name, owner, or labels. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -2331,7 +2334,7 @@ Checks whether an app account has specific labels. This API uses a promise to re ...@@ -2331,7 +2334,7 @@ Checks whether an app account has specific labels. This API uses a promise to re
| ID| Error Message| | ID| Error Message|
| ------- | ------- | | ------- | ------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or labels. | | 12300002 | Invalid name, owner, or labels. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -2594,7 +2597,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t ...@@ -2594,7 +2597,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t
| ID| Error Message| | ID| Error Message|
| ------- | -------| | ------- | -------|
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name or owner or options. | | 12300002 | Invalid name, owner, or options. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12300010 | Account service busy. | | 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. | | 12300113 | Authenticator service not found. |
...@@ -4289,8 +4292,10 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4289,8 +4292,10 @@ Obtains the authenticator callback for an authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant((err, want) => {
export default class EntryAbility extends UIAbility {
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
if (err.code != account_appAccount.ResultCode.SUCCESS) { if (err.code != account_appAccount.ResultCode.SUCCESS) {
...@@ -4303,7 +4308,8 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4303,7 +4308,8 @@ Obtains the authenticator callback for an authentication session. This API uses
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}); });
}); }
}
``` ```
### getAuthenticatorCallback<sup>(deprecated)</sup> ### getAuthenticatorCallback<sup>(deprecated)</sup>
...@@ -4333,9 +4339,10 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4333,9 +4339,10 @@ Obtains the authenticator callback for an authentication session. This API uses
**Example** **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
featureAbility.getWant().then((want) => { export default class EntryAbility extends UIAbility {
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi",
...@@ -4346,9 +4353,8 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4346,9 +4353,8 @@ Obtains the authenticator callback for an authentication session. This API uses
}).catch((err) => { }).catch((err) => {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
}); });
}).catch((err) => { }
console.log("getWant err: " + JSON.stringify(err)); }
});
``` ```
### getAuthenticatorInfo<sup>(deprecated)</sup> ### getAuthenticatorInfo<sup>(deprecated)</sup>
...@@ -4562,7 +4568,8 @@ Enumerates the constants. ...@@ -4562,7 +4568,8 @@ Enumerates the constants.
Enumerates the result codes. Enumerates the result codes.
> **NOTE**<br> > **NOTE**
>
> This enum is supported since API version 8 and deprecated since API version 9. Error codes are used from API version 9. For details, see [Account Management Error Codes](../errorcodes/errorcode-account.md). > This enum is supported since API version 8 and deprecated since API version 9. Error codes are used from API version 9. For details, see [Account Management Error Codes](../errorcodes/errorcode-account.md).
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
......
...@@ -1736,7 +1736,7 @@ Moves a file. This API uses a promise to return the result. ...@@ -1736,7 +1736,7 @@ Moves a file. This API uses a promise to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------------------------- | | ------ | ------ | ---- | --------------------------- |
| src | string | Yes | Application sandbox path of the source file.| | src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.| | dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example** **Example**
...@@ -1764,7 +1764,7 @@ Moves a file. This API uses an asynchronous callback to return the result. ...@@ -1764,7 +1764,7 @@ Moves a file. This API uses an asynchronous callback to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------------------------- | | ------ | ------ | ---- | --------------------------- |
| src | string | Yes | Application sandbox path of the source file.| | src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.| | dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is moved. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the file is moved. |
...@@ -1795,7 +1795,7 @@ Moves a file synchronously. ...@@ -1795,7 +1795,7 @@ Moves a file synchronously.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------------------------- | | ------ | ------ | ---- | --------------------------- |
| src | string | Yes | Application sandbox path of the source file.| | src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.| | dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example** **Example**
...@@ -1938,7 +1938,7 @@ Creates a stream based on the file path. This API uses an asynchronous callback ...@@ -1938,7 +1938,7 @@ Creates a stream based on the file path. This API uses an asynchronous callback
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| path | string | Yes | Application sandbox path of the file. | | path | string | Yes | Application sandbox path of the 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 created asynchronously. |
**Example** **Example**
......
# @ohos.file.picker (Picker) # @ohos.file.picker (File Picker)
**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.
**Picker** encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving images, videos, documents, and audio clips. The application can select the picker as required.
## Modules to Import ## Modules to Import
```js ```js
import picker from '@ohos.file.picker'; import picker from '@ohos.file.picker';
...@@ -27,7 +27,7 @@ let photoPicker = new picker.PhotoViewPicker(); ...@@ -27,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
...@@ -35,7 +35,7 @@ Selects one or more images or videos in a **photoPicker** page. This API uses a ...@@ -35,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**
...@@ -67,7 +67,7 @@ async function example() { ...@@ -67,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
...@@ -145,7 +145,7 @@ Saves one or more images or videos in a **photoPicker** page. This API uses a pr ...@@ -145,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**
...@@ -265,7 +265,7 @@ Selects one or more documents in a **documentPicker** page. This API uses a prom ...@@ -265,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**
...@@ -372,7 +372,7 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis ...@@ -372,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**
...@@ -492,7 +492,7 @@ Selects one or more audio files in an **audioPicker** page (currently, a **docum ...@@ -492,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**
...@@ -590,7 +590,7 @@ async function example() { ...@@ -590,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
...@@ -598,7 +598,7 @@ Saves one or more audio files in an **audioPicker** page (currently, a **documen ...@@ -598,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**
...@@ -629,7 +629,7 @@ async function example() { ...@@ -629,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
...@@ -714,7 +714,7 @@ Defines the options for selecting images or videos. ...@@ -714,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
...@@ -736,7 +736,7 @@ Defines the options for saving images or videos. ...@@ -736,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
...@@ -752,11 +752,11 @@ Defines the options for saving documents. ...@@ -752,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
...@@ -768,4 +768,4 @@ Defines the options for saving audio files. ...@@ -768,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.|
...@@ -36,7 +36,6 @@ class MainAbility extends Ability { ...@@ -36,7 +36,6 @@ class MainAbility extends Ability {
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext(); let context = featureAbility.getContext();
context.getFilesDir().then((data) => { context.getFilesDir().then((data) => {
let pathDir = data; let pathDir = data;
...@@ -61,9 +60,9 @@ Obtains file information. This API uses a promise to return the result. ...@@ -61,9 +60,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**
...@@ -118,9 +117,9 @@ Synchronously obtains file information. ...@@ -118,9 +117,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**
...@@ -146,9 +145,9 @@ Opens a file directory. This API uses a promise to return the result. ...@@ -146,9 +145,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**
...@@ -204,9 +203,9 @@ Synchronously opens a directory. ...@@ -204,9 +203,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**
...@@ -234,9 +233,9 @@ Checks whether the current process can access a file. This API uses a promise to ...@@ -234,9 +233,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**
...@@ -313,15 +312,15 @@ Closes a file. This API uses a promise to return the result. ...@@ -313,15 +312,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**
...@@ -346,10 +345,10 @@ Closes a file. This API uses an asynchronous callback to return the result. ...@@ -346,10 +345,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**
...@@ -372,9 +371,9 @@ Synchronously closes a file. ...@@ -372,9 +371,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**
...@@ -395,17 +394,17 @@ Copies a file. This API uses a promise to return the result. ...@@ -395,17 +394,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**
...@@ -430,12 +429,12 @@ Copies a file. This API uses an asynchronous callback to return the result. ...@@ -430,12 +429,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**
...@@ -458,11 +457,11 @@ Synchronously copies a file. ...@@ -458,11 +457,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**
...@@ -486,13 +485,13 @@ Creates a directory. This API uses a promise to return the result. ...@@ -486,13 +485,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**
...@@ -519,7 +518,7 @@ Creates a directory. This API uses an asynchronous callback to return the result ...@@ -519,7 +518,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**
...@@ -545,7 +544,7 @@ Synchronously creates a directory. ...@@ -545,7 +544,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**
...@@ -569,13 +568,13 @@ Opens a file. This API uses a promise to return the result. ...@@ -569,13 +568,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**
...@@ -603,7 +602,7 @@ Opens a file. This API uses an asynchronous callback to return the result. ...@@ -603,7 +602,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**
...@@ -630,13 +629,13 @@ Synchronously opens a file. ...@@ -630,13 +629,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**
...@@ -673,9 +672,9 @@ Reads data from a file. This API uses a promise to return the result. ...@@ -673,9 +672,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**
...@@ -702,12 +701,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res ...@@ -702,12 +701,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**
...@@ -734,17 +733,17 @@ Synchronously reads data from a file. ...@@ -734,17 +733,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**
...@@ -772,9 +771,9 @@ Deletes a directory. This API uses a promise to return the result. ...@@ -772,9 +771,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**
...@@ -852,9 +851,9 @@ Deletes a file. This API uses a promise to return the result. ...@@ -852,9 +851,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**
...@@ -925,17 +924,17 @@ Writes data into a file. This API uses a promise to return the result. ...@@ -925,17 +924,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**
...@@ -960,12 +959,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re ...@@ -960,12 +959,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**
...@@ -990,17 +989,17 @@ Synchronously writes data into a file. ...@@ -990,17 +989,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**
...@@ -1028,9 +1027,9 @@ Calculates the hash value of a file. This API uses a promise to return the resul ...@@ -1028,9 +1027,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**
...@@ -1085,13 +1084,13 @@ Changes file permissions. This API uses a promise to return the result. ...@@ -1085,13 +1084,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**
...@@ -1118,7 +1117,7 @@ Changes file permissions. This API uses an asynchronous callback to return the r ...@@ -1118,7 +1117,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**
...@@ -1144,7 +1143,7 @@ Synchronously changes file permissions. ...@@ -1144,7 +1143,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**
...@@ -1164,14 +1163,14 @@ Obtains file information based on the file descriptor. This API uses a promise t ...@@ -1164,14 +1163,14 @@ 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**
...@@ -1197,10 +1196,10 @@ Obtains file information based on the file descriptor. This API uses an asynchro ...@@ -1197,10 +1196,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**
...@@ -1223,14 +1222,14 @@ Synchronously obtains file information based on the file descriptor. ...@@ -1223,14 +1222,14 @@ 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**
...@@ -1252,16 +1251,16 @@ Truncates a file based on the file descriptor. This API uses a promise to return ...@@ -1252,16 +1251,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**
...@@ -1286,11 +1285,11 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal ...@@ -1286,11 +1285,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**
...@@ -1314,10 +1313,10 @@ Synchronously truncates a file based on the file descriptor. ...@@ -1314,10 +1313,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**
...@@ -1346,9 +1345,9 @@ Truncates a file based on the file path. This API uses a promise to return the r ...@@ -1346,9 +1345,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**
...@@ -1431,9 +1430,9 @@ Reads the text content of a file. This API uses a promise to return the result. ...@@ -1431,9 +1430,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**
...@@ -1490,9 +1489,9 @@ Synchronously reads the text of a file. ...@@ -1490,9 +1489,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**
...@@ -1518,9 +1517,9 @@ Obtains link information. This API uses a promise to return the result. ...@@ -1518,9 +1517,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**
...@@ -1575,9 +1574,9 @@ Synchronously obtains the link information. ...@@ -1575,9 +1574,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**
...@@ -1604,9 +1603,9 @@ Renames a file. This API uses a promise to return the result. ...@@ -1604,9 +1603,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**
...@@ -1681,15 +1680,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ...@@ -1681,15 +1680,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**
...@@ -1714,10 +1713,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return ...@@ -1714,10 +1713,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**
...@@ -1740,9 +1739,9 @@ Flushes data of a file to disk in synchronous mode. ...@@ -1740,9 +1739,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**
...@@ -1763,15 +1762,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** ...@@ -1763,15 +1762,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**
...@@ -1796,10 +1795,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return ...@@ -1796,10 +1795,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**
...@@ -1822,9 +1821,9 @@ Synchronizes data in a file in synchronous mode. ...@@ -1822,9 +1821,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**
...@@ -1852,9 +1851,9 @@ Creates a symbolic link based on the file path. This API uses a promise to retur ...@@ -1852,9 +1851,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**
...@@ -1938,9 +1937,9 @@ Changes the file owner based on the file path. This API uses a promise to return ...@@ -1938,9 +1937,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**
...@@ -2018,15 +2017,15 @@ Creates a temporary directory. This API uses a promise to return the result. ...@@ -2018,15 +2017,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**
...@@ -2049,10 +2048,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return ...@@ -2049,10 +2048,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**
...@@ -2073,15 +2072,15 @@ Synchronously creates a temporary directory. ...@@ -2073,15 +2072,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**
...@@ -2100,16 +2099,16 @@ Changes file permissions based on the file descriptor. This API uses a promise t ...@@ -2100,16 +2099,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**
...@@ -2135,11 +2134,11 @@ Changes file permissions based on the file descriptor. This API uses an asynchro ...@@ -2135,11 +2134,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**
...@@ -2163,10 +2162,10 @@ Synchronously changes the file permissions based on the file descriptor. ...@@ -2163,10 +2162,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**
...@@ -2195,9 +2194,9 @@ Opens a file stream based on the file path. This API uses a promise to return th ...@@ -2195,9 +2194,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**
...@@ -2254,9 +2253,9 @@ Synchronously opens a stream based on the file path. ...@@ -2254,9 +2253,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**
...@@ -2276,16 +2275,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret ...@@ -2276,16 +2275,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**
...@@ -2310,11 +2309,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous ...@@ -2310,11 +2309,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**
...@@ -2337,16 +2336,16 @@ Synchronously opens a stream based on the file descriptor. ...@@ -2337,16 +2336,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**
...@@ -2367,17 +2366,17 @@ Changes the file owner based on the file descriptor. This API uses a promise to ...@@ -2367,17 +2366,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**
...@@ -2403,12 +2402,12 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono ...@@ -2403,12 +2402,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**
...@@ -2432,11 +2431,11 @@ Synchronously changes the file owner based on the file descriptor. ...@@ -2432,11 +2431,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**
...@@ -2466,9 +2465,9 @@ Changes the file owner (owner of the symbolic link, not the file referred to by ...@@ -2466,9 +2465,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**
...@@ -2554,9 +2553,9 @@ Listens for file or directory changes. This API uses an asynchronous callback to ...@@ -2554,9 +2553,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**
...@@ -2616,9 +2615,9 @@ Checks whether this file is a block special file. A block special file supports ...@@ -2616,9 +2615,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**
...@@ -2638,9 +2637,9 @@ Checks whether this file is a character special file. A character special file s ...@@ -2638,9 +2637,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**
...@@ -2660,9 +2659,9 @@ Checks whether this file is a directory. ...@@ -2660,9 +2659,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**
...@@ -2682,9 +2681,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int ...@@ -2682,9 +2681,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**
...@@ -2704,9 +2703,9 @@ Checks whether this file is a regular file. ...@@ -2704,9 +2703,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**
...@@ -2726,9 +2725,9 @@ Checks whether this file is a socket. ...@@ -2726,9 +2725,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**
...@@ -2748,9 +2747,9 @@ Checks whether this file is a symbolic link. ...@@ -2748,9 +2747,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**
...@@ -2796,9 +2795,9 @@ Stops the **watcher** instance. This API uses an asynchronous callback to return ...@@ -2796,9 +2795,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**
...@@ -2828,9 +2827,9 @@ Closes the stream. This API uses a promise to return the result. ...@@ -2828,9 +2827,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**
...@@ -2855,9 +2854,9 @@ Closes the stream. This API uses an asynchronous callback to return the result. ...@@ -2855,9 +2854,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**
...@@ -2897,9 +2896,9 @@ Flushes the stream. This API uses a promise to return the result. ...@@ -2897,9 +2896,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**
...@@ -2924,9 +2923,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result. ...@@ -2924,9 +2923,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**
...@@ -2966,16 +2965,16 @@ Writes data into the stream. This API uses a promise to return the result. ...@@ -2966,16 +2965,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**
...@@ -3000,11 +2999,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th ...@@ -3000,11 +2999,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**
...@@ -3030,16 +3029,16 @@ Synchronously writes data into the stream. ...@@ -3030,16 +3029,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**
...@@ -3060,16 +3059,16 @@ Reads data from the stream. This API uses a promise to return the result. ...@@ -3060,16 +3059,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**
...@@ -3095,11 +3094,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the ...@@ -3095,11 +3094,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**
...@@ -3125,16 +3124,16 @@ Synchronously reads data from the stream. ...@@ -3125,16 +3124,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**
...@@ -3160,9 +3159,9 @@ Reads the next directory entry. This API uses a promise to return the result. ...@@ -3160,9 +3159,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**
...@@ -3185,9 +3184,9 @@ Reads the next directory entry. This API uses an asynchronous callback to return ...@@ -3185,9 +3184,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**
...@@ -3211,9 +3210,9 @@ Synchronously reads the next directory entry. ...@@ -3211,9 +3210,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**
...@@ -3294,9 +3293,9 @@ Checks whether this directory entry is a block special file. A block special fil ...@@ -3294,9 +3293,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**
...@@ -3316,9 +3315,9 @@ Checks whether a directory entry is a character special file. A character specia ...@@ -3316,9 +3315,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**
...@@ -3338,9 +3337,9 @@ Checks whether a directory entry is a directory. ...@@ -3338,9 +3337,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**
...@@ -3360,9 +3359,9 @@ Checks whether this directory entry is a named pipe (or FIFO). Named pipes are u ...@@ -3360,9 +3359,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**
...@@ -3382,9 +3381,9 @@ Checks whether a directory entry is a regular file. ...@@ -3382,9 +3381,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**
...@@ -3404,9 +3403,9 @@ Checks whether a directory entry is a socket. ...@@ -3404,9 +3403,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**
...@@ -3426,9 +3425,9 @@ Checks whether a directory entry is a symbolic link. ...@@ -3426,9 +3425,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**
......
...@@ -328,7 +328,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u ...@@ -328,7 +328,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId or constraint. | | 12300002 | invalid localId or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Check whether OS account 100 is forbidden to use Wi-Fi. **Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
...@@ -378,7 +378,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u ...@@ -378,7 +378,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId or constraint. | | 12300002 | invalid localId or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Check whether OS account 100 is forbidden to use Wi-Fi. **Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
...@@ -529,7 +529,7 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca ...@@ -529,7 +529,7 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -577,7 +577,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur ...@@ -577,7 +577,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -2231,7 +2231,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn ...@@ -2231,7 +2231,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid serialNumber. | | 12300002 | invalid serialNumber. |
| 12300003 | the account indicated by serialNumber dose not exist. | | 12300003 | The account indicated by serialNumber dose not exist. |
**Example**: Obtain the ID of the OS account whose SN is 12345. **Example**: Obtain the ID of the OS account whose SN is 12345.
...@@ -2274,7 +2274,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the ...@@ -2274,7 +2274,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid serialNumber. | | 12300002 | invalid serialNumber. |
| 12300003 | the account indicated by serialNumber dose not exist. | | 12300003 | The account indicated by serialNumber dose not exist. |
**Example**: Obtain the ID of the OS account whose SN is 12345. **Example**: Obtain the ID of the OS account whose SN is 12345.
...@@ -2313,7 +2313,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch ...@@ -2313,7 +2313,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Obtain the SN of the OS account 100. **Example**: Obtain the SN of the OS account 100.
...@@ -2356,7 +2356,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise ...@@ -2356,7 +2356,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid localId. | | 12300002 | invalid localId. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example**: Obtain the SN of the OS account 100. **Example**: Obtain the SN of the OS account 100.
...@@ -2390,7 +2390,7 @@ Subscribes to the OS account activation states, including the states of the acco ...@@ -2390,7 +2390,7 @@ Subscribes to the OS account activation states, including the states of the acco
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | Yes | Type of the event to subscribe to. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.| | type | 'activate' \| 'activating' | Yes | Type of the event to subscribe to. The value **activate** indicates the state of an OS account activated, and **activating** indicates the state of an OS account being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes. | | name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes. |
| callback | Callback&lt;number&gt; | Yes | Callback invoked to return the ID of the OS account being activated or activated. | | callback | Callback&lt;number&gt; | Yes | Callback invoked to return the ID of the OS account being activated or activated. |
...@@ -2432,7 +2432,7 @@ Unsubscribes from the OS account activation states, including the states of the ...@@ -2432,7 +2432,7 @@ Unsubscribes from the OS account activation states, including the states of the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.| | type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate** indicates the state of an OS account activated, and **activating** indicates the state of an OS account being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.| | name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.|
| callback | Callback&lt;number&gt; | No | Callback to unregister. By default, **0** is returned. | | callback | Callback&lt;number&gt; | No | Callback to unregister. By default, **0** is returned. |
...@@ -2642,7 +2642,7 @@ Obtains the constraint source information of an OS account. This API uses an asy ...@@ -2642,7 +2642,7 @@ Obtains the constraint source information of an OS account. This API uses an asy
| -------- | ------------- | | -------- | ------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid name or constraint. | | 12300002 | invalid name or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -2689,7 +2689,7 @@ Obtains the constraint source information of an OS account. This API uses a prom ...@@ -2689,7 +2689,7 @@ Obtains the constraint source information of an OS account. This API uses a prom
| -------- | ------------- | | -------- | ------------- |
| 12300001 | system service exception. | | 12300001 | system service exception. |
| 12300002 | invalid name or constraint. | | 12300002 | invalid name or constraint. |
| 12300003 | the account indicated by localId dose not exist. | | 12300003 | The account indicated by localId dose not exist. |
**Example** **Example**
...@@ -3600,7 +3600,7 @@ Obtains the type of the account to which the current process belongs. This API u ...@@ -3600,7 +3600,7 @@ Obtains the type of the account to which the current process belongs. This API u
getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
Obtains the ID of the distributed virtual device. This API uses an asynchronous callback to return the result. Obtains the ID of this distributed virtual device. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**
> >
...@@ -3630,7 +3630,7 @@ Obtains the ID of the distributed virtual device. This API uses an asynchronous ...@@ -3630,7 +3630,7 @@ Obtains the ID of the distributed virtual device. This API uses an asynchronous
getDistributedVirtualDeviceId(): Promise&lt;string&gt; getDistributedVirtualDeviceId(): Promise&lt;string&gt;
Obtains the ID of the distributed virtual device. This API uses a promise to return the result. Obtains the ID of this distributed virtual device. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> >
...@@ -5389,7 +5389,7 @@ Defines the OS account information. ...@@ -5389,7 +5389,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. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册