diff --git a/en/application-dev/napi/rawfile-guidelines.md b/en/application-dev/napi/rawfile-guidelines.md index 29f66194bd40cd4f7a228213734db2ad65c81180..c585b162a2dc483ca72a5369170b2ee0f43a01a1 100644 --- a/en/application-dev/napi/rawfile-guidelines.md +++ b/en/application-dev/napi/rawfile-guidelines.md @@ -4,7 +4,7 @@ ## When to Use -This document describes how to use the native Rawfile APIs to manage raw file directories and files in OpenHarmony. The table below describes the APIs. +This document describes how to use the native Rawfile APIs to manage raw file directories and files in OpenHarmony. You can use the APIs to traverse, open, search for, read, and close raw files. ## Available APIs @@ -16,14 +16,14 @@ This document describes how to use the native Rawfile APIs to manage raw file di | const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index) | Obtains the name of a raw file. | | RawFile *OH_ResourceManager_OpenRawFile(const NativeResourceManager *mgr, const char *fileName) | Opens a raw file. | | long OH_ResourceManager_GetRawFileSize(RawFile *rawFile) | Obtains the size of a raw file. | -| int OH_ResourceManager_SeekRawFile(const RawFile *rawFile, long offset, int whence) | Seeks a data read/write position in a raw file based on the specified offset. | +| int OH_ResourceManager_SeekRawFile(const RawFile *rawFile, long offset, int whence) | Seeks a read/write position in a raw file based on the specified offset. | | long OH_ResourceManager_GetRawFileOffset(const RawFile *rawFile) | Obtains the offset. | | int OH_ResourceManager_ReadRawFile(const RawFile *rawFile, void *buf, size_t length) | Reads a raw file. | | void OH_ResourceManager_CloseRawFile(RawFile *rawFile) | Closes a raw file to release resources. | | void OH_ResourceManager_CloseRawDir(RawDir *rawDir) | Closes a raw file directory to release resources. | -| bool OH_ResourceManager_GetRawFileDescriptor(const RawFile *rawFile, RawFileDescriptor &descriptor) | Obtains the file description (FD) of a raw file. | +| bool OH_ResourceManager_GetRawFileDescriptor(const RawFile *rawFile, RawFileDescriptor &descriptor) | Obtains the file descriptor (FD) of a raw file. | | bool OH_ResourceManager_ReleaseRawFileDescriptor(const RawFileDescriptor &descriptor) | Releases the FD of a raw file. | -| void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr) | Releases native resource manager resources. | +| void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr) | Releases the native resource manager. | ## How to Develop @@ -38,7 +38,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di 2. Call **OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr)** to obtain a **NativeResourceManager** instance. ```js - // Call the JS API to pass the JS resource manager. + // Import the JS resource manager from the JS head file and pass it to the C++ file. import resManager from '@ohos.resourceManager' import rawfileTest from 'librawFileTest.so' resManager.getResourceManager().then(resmgr => { @@ -49,7 +49,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di ``` ```c++ - // The C++ API obtains and parses the parameters passed by the JS API. + // Obtain and parse the parameters in the C++ file. NativeResourceManager* nativeResourceManager = nullptr; std::string path; if (i == 0 && valueType == napi_string) { @@ -57,7 +57,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di ...... path = buf.data(); } else if (i == 1 && valueType == napi_object) { - // Parse the second parameter, which is the resource manager. + // Parse the second parameter, which is the JS resource manager. nativeResourceManager = OH_ResourceManager_InitNativeResourceManager(env, argv[i]); } ``` @@ -80,7 +80,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di -5. Call **OH_ResourceManager_GetRawFileName** to obtain the name of the raw file based on the specified index. +5. Call **OH_ResourceManager_GetRawFileName** to obtain the name of the raw file with the specified index. ```c++ for (int index = 0; index < count; index++) { @@ -90,7 +90,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di -6. Call **OH_ResourceManager_OpenRawFile** to obtain a **RawFile** instance based on the specified file name. +6. Call **OH_ResourceManager_OpenRawFile** to obtain a **RawFile** instance with the specified file name. ```c++ RawFile* rawFile = OH_ResourceManager_OpenRawFile(nativeResourceManager, fileName.c_str()); @@ -106,7 +106,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di -8. Call **OH_ResourceManager_SeekRawFile** to seek a data read/write position in the raw file based on the specified offset. +8. Call **OH_ResourceManager_SeekRawFile** to seek a read/write position in the raw file based on the specified offset. ```c++ int position = OH_ResourceManager_SeekRawFile(rawFile, 10, 0); @@ -124,7 +124,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di -10. Call **OH_ResourceManager_ReadRawFile** to read a raw file. +10. Call **OH_ResourceManager_ReadRawFile** to read the raw file. ```c++ std::unique_ptr mediaData = std::make_unique(rawFileSize); @@ -149,7 +149,7 @@ This document describes how to use the native Rawfile APIs to manage raw file di -13. Call **OH_ResourceManager_GetRawFileDescriptor** to obtain **RawFileDescriptor** of the raw file. +13. Call **OH_ResourceManager_GetRawFileDescriptor** to obtain the FD of the raw file. ```c++ RawFileDescriptor descriptor; diff --git a/en/application-dev/reference/apis/js-apis-filemanager.md b/en/application-dev/reference/apis/js-apis-filemanager.md index 88f58da288e50a05731fda26de56581fa5a46e0e..07190f596f3c87a8b89e570b6462ccbb574ea286 100644 --- a/en/application-dev/reference/apis/js-apis-filemanager.md +++ b/en/application-dev/reference/apis/js-apis-filemanager.md @@ -83,8 +83,8 @@ Obtains information about the second-level album or files in asynchronous mode. - Parameters | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | path | promise| Yes| URI of the directory to query.| - | type | promise| Yes| Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| + | path | string | Yes| URI of the directory to query.| + | type | string | Yes| Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.
-  **offset**: position to start the query. The value is a number.
-  **count**: number of files to query.| - Return value @@ -130,8 +130,8 @@ Obtains information about the second-level album or files in asynchronous mode. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | - | path | promise | Yes | URI of the directory to query. | - | type | promise | Yes | Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| + | path | string | Yes | URI of the directory to query. | + | type | string | Yes | Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.
-  **offset**: position to start the query. The value is a number.
-  **count**: number of files to query.| | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. | - Error @@ -167,8 +167,8 @@ Creates a file in the specified path in asynchronous mode. This API uses a promi - Parameters | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | filename | promise| Yes| Name of the file to create.| - | path | promise| Yes| URI of the file to create.| + | filename | string | Yes| Name of the file to create.| + | path | string | Yes| URI of the file to create.| | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| - Return value @@ -211,8 +211,8 @@ Creates a file in the specified path in asynchronous mode. This API uses a callb | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ----------------------------- | - | filename | promise | Yes | Name of the file to create. | - | path | promise | Yes | URI of the file to create. | + | filename | string | Yes | Name of the file to create. | + | path | string | Yes | URI of the file to create. | | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. | @@ -248,9 +248,9 @@ Defines the file information returned by **getRoot()** or **listFile()**. | Name| Type| Readable| Writable| Description| | --- | -- | -- | -- | -- | -| name | promise| Yes| No| File name.| -| path | promise| Yes| No| URI of the file.| -| type | promise| Yes| No| File type.| +| name | string | Yes| No| File name.| +| path | string | Yes| No| URI of the file.| +| type | string | Yes| No| File type.| | size | number | Yes| No| File size.| | addedTime | number | Yes| No| Time when the file was scanned to the database.| | modifiedTime | number | Yes| No| Time when the file was modified.| @@ -265,4 +265,4 @@ Defines the device type. | Name| Type | Readable| Writable| Description | | ------ | ------ | ---- | ---- | -------- | -| name | promise| Yes | Yes | Device name.| +| name | string | Yes | Yes | Device name.| diff --git a/en/application-dev/security/huks-guidelines.md b/en/application-dev/security/huks-guidelines.md index 4ab463df4e08413c827b88d4da2553530bde5cb1..a7751c6625d9af9466b3f576cc3bae17b34e23b7 100644 --- a/en/application-dev/security/huks-guidelines.md +++ b/en/application-dev/security/huks-guidelines.md @@ -2,21 +2,21 @@ ## When to Use - Openharmony Universal KeyStore (HUKS) provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. HUKS also provides APIs for applications to import or generate keys. + OpenHarmony Universal KeyStore (HUKS) provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. HUKS also provides APIs for applications to import or generate keys. ## Available APIs -| API | Description | +| API | Description | | ------------------------------------------------------------ | ---------------- | -| function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void; | Generates a private key. This method uses an asynchronous callback to return the result. | -| function generateKey(keyAlias: string, options: HuksOptions) : Promise\; | Generates a private key. This method uses a promise to return the result. | -| function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void; | Exports the public key. This method uses an asynchronous callback to return the result. | -| function exportKey(keyAlias: string, options: HuksOptions) : Promise\; | Exports the public key. This method uses a promise to return the result. | -| function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void; | Check whether a key exists. This method uses an asynchronous callback to return the result.| -| function isKeyExist(keyAlias: string, options: HuksOptions) : Promise\; | Check whether a key exists. This method uses a promise to return the result.| -| function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void; | Deletes a key. This method uses an asynchronous callback to return the result. | -| function deleteKey(keyAlias: string, options: HuksOptions) : Promise\; | Deletes a key. This method uses a promise to return the result. | +| generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void| Generates a key. This method uses an asynchronous callback to return the result. | +| generateKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>| Generates a key. This method uses a promise to return the result. | +| exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void| Exports the public key. This method uses an asynchronous callback to return the result. | +| exportKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>| Exports the public key. This method uses a promise to return the result. | +| isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>) : void | Checks whether a key exists. This method uses an asynchronous callback to return the result.| +| isKeyExist(keyAlias: string, options: HuksOptions) : Promise<boolean> | Checks whether a key exists. This method uses a promise to return the result.| +| deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void| Deletes a key. This method uses an asynchronous callback to return the result. | +| deleteKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>| Deletes a key. This method uses a promise to return the result. | ## How to Develop @@ -26,7 +26,7 @@ import huks from '@ohos.security.huks' ``` -2. Call **generateKey()** to generate a private key. +2. Call **generateKey()** to generate a key. **keyAlias** indicates the alias of the key generated. **options** indicates the parameters used for generating the key. Set **options** based on the actual situation. @@ -59,7 +59,7 @@ 3. Call **Init()** to initialize the key. - **Alias** indicates the alias of the key to initialize, and **options** indicates the parameters used for initializing the key. + **Alias** indicates the alias of the key to initialize, and **options** indicates the parameters used for initializing the key. Set **options** based on the actual situation. The value returned indicates whether the **Init** operation is successful. @@ -92,7 +92,7 @@ 4. Call **update()** to update the key. - **handle** indicates the session ID for updating the key. **options** indicates the parameters used for updating the key. + **handle** indicates the session ID for updating the key. **options** indicates the parameters used for updating the key. Set **options** based on the actual situation. The value returned indicates whether the **Update** operation is successful. @@ -118,7 +118,7 @@ 5. Call **finish()** to complete the operation. - **handle** indicates the session ID of the **Finish** operation. **options** indicates the parameters used for this operation. + **handle** indicates the session ID of the **Finish** operation. **options** indicates the parameters used for this operation. Set **options** based on the actual situation. The value returned indicates whether the **Finish** operation is successful.