// Check whether the number is 0. If yes, the API call is successful, but the result set is empty. Check whether the options for fetching the files are correctly set and whether the corresponding files exist on the device.
if(count==0){
console.info('The count of fetchFileResult is zero');
// Check whether the number is 0. If yes, the API call is successful, but the result set is empty. Check whether the options for fetching the files are correctly set and whether the corresponding files exist on the device.
console.error('Failed to get first object: '+err);
if(count==0){
console.info('The count of fetchFileResult is zero');
Opens this file asset. This API uses an asynchronous callback to return the result.
Opens this file asset. This API uses an asynchronous callback to return the result.
> **NOTE**
**NOTE**: When a file is opened in 'w' mode, the returned FD cannot be read. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to release the resource.
>
> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
...
@@ -1222,13 +1250,13 @@ async function example() {
...
@@ -1222,13 +1250,13 @@ async function example() {
Opens this file asset. This API uses a promise to return the result.
Opens this file asset. This API uses a promise to return the result.
> **NOTE**
**NOTE**: When a file is opened in 'w' mode, the returned FD cannot be read. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to release the resource.
>
> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
...
@@ -1266,14 +1292,12 @@ async function example() {
...
@@ -1266,14 +1292,12 @@ async function example() {
Obtains the next file asset in the result set. This API uses an asynchronous callback to return the result.
Obtains the next file asset in the result set. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to ensure that the cursor does not point to the last file asset in the result set.
Obtains the next file asset in the result set. This API uses a promise to return the result.
Obtains the next file asset in the result set. This API uses a promise to return the result.
> **NOTE**
>
> Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to ensure that the cursor does not point to the last file asset in the result set.
| MIME_TYPE | 'mime_type' | Extended file attributes, such as image/, video/, and file/*. |
| MEDIA_TYPE | "media_type" | Media type. |
| MEDIA_TYPE | 'media_type' | Media type. |
| SIZE | "size" | File size, in bytes. |
| SIZE | 'size' | File size, in bytes. |
| DATE_ADDED | "date_added" | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_ADDED | 'date_added' | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | "date_modified" | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.|
| DATE_MODIFIED | 'date_modified' | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.|
| DATE_TAKEN | "date_taken" | Date when the file (photo) was taken. The value is the number of seconds elapsed since the Epoch time. |
| DATE_TAKEN | 'date_taken' | Date when the file (photo) was taken. The value is the number of seconds elapsed since the Epoch time. |
| TITLE | "title" | Title in the file. |
| TITLE | 'title' | Title in the file. |
| ARTIST | "artist" | Artist of the file. |
| ARTIST | 'artist' | Artist of the file. |
| AUDIOALBUM | "audio_album" | Audio album. |
| AUDIOALBUM | 'audio_album' | Audio album. |
| DURATION | "duration" | Duration, in ms. |
| DURATION | 'duration' | Duration, in ms. |
| WIDTH | "width" | Image width, in pixels. |
| WIDTH | 'width' | Image width, in pixels. |
| HEIGHT | "height" | Image height, in pixels. |
| HEIGHT | 'height' | Image height, in pixels. |
| ORIENTATION | "orientation" | Image display direction (clockwise rotation angle, for example, 0, 90, and 180, in degrees).|
| ORIENTATION | 'orientation' | Image display direction (clockwise rotation angle, for example, 0, 90, and 180, in degrees).|
| ALBUM_ID | "bucket_id" | ID of the album to which the file belongs. |
| ALBUM_ID | 'bucket_id' | ID of the album to which the file belongs. |
| ALBUM_NAME | "bucket_display_name" | Name of the album to which the file belongs. |
| ALBUM_NAME | 'bucket_display_name' | Name of the album to which the file belongs. |
## DirectoryType<sup>8+</sup>
## DirectoryType<sup>8+</sup>
...
@@ -2559,9 +2623,9 @@ Describes options for fetching media files.
...
@@ -2559,9 +2623,9 @@ Describes options for fetching media files.
| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
| selectionArgs | Array<string> | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
| selectionArgs | Array<string> | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " ASC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"|
| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + ' ASC'<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + ' DESC'|
@@ -26,7 +26,7 @@ Formats the specified values and inserts them into the string by replacing the w
...
@@ -26,7 +26,7 @@ Formats the specified values and inserts them into the string by replacing the w
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| ------- | -------- | ---- | -------------- |
| ------- | -------- | ---- | -------------- |
| format | string | Yes | String.|
| format | string | Yes | String.|
| ...args | Object[] | No | Values to format. The formatted values will be replaced the wildcard in the string. |
| ...args | Object[] | No | Values to format. The formatted values will replace the wildcard in the string. If this parameter is not set, the first parameter is returned by default.|
**Return value**
**Return value**
...
@@ -69,6 +69,20 @@ let result = util.errnoToString(errnum);
...
@@ -69,6 +69,20 @@ let result = util.errnoToString(errnum);
@@ -201,7 +220,7 @@ Uses a secure random number generator to generate a random binary UUID of RFC 41
...
@@ -201,7 +220,7 @@ Uses a secure random number generator to generate a random binary UUID of RFC 41
parseUUID(uuid: string): Uint8Array
parseUUID(uuid: string): Uint8Array
Parses a UUID from a string, as described in RFC 4122 version 4.
Converts the UUID of the string type generated by **generateRandomUUID** to the UUID of the **Uint8Array** type generated by **generateRandomBinaryUUID**, as described in RFC 4122 version 4.
@@ -243,7 +262,7 @@ Formats the specified values and inserts them into the string by replacing the w
...
@@ -243,7 +262,7 @@ Formats the specified values and inserts them into the string by replacing the w
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| format | string | Yes| String.|
| format | string | Yes| String.|
| ...args | Object[] | No| Values to format. The formatted values will be replaced the wildcard in the string.|
| ...args | Object[] | No| Values to format. The formatted values will replace the wildcard in the string. If this parameter is not set, the first parameter is returned by default.|
**Return value**
**Return value**
...
@@ -361,8 +380,8 @@ Creates a **TextDecoder** object. It provides the same function as the deprecate
...
@@ -361,8 +380,8 @@ Creates a **TextDecoder** object. It provides the same function as the deprecate