>- The initial APIs of this module are supported since API version 8. 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.
>- The APIs of this module are system APIs and cannot be called by third-party applications. Currently, these APIs can be called only by **filepicker**.
>- The APIs of this module are system APIs and cannot be called by third-party applications. Currently, these APIs can be called only by **filepicker**.
This module provides service APIs for accessing and managing user files. It interworks with the underlying file management services to implement media library and external card management, and provides capabilities for applications to query and create user files.
## Modules to Import
## Modules to Import
```js
```js
...
@@ -81,8 +83,8 @@ Obtains information about the second-level album or files in asynchronous mode.
...
@@ -81,8 +83,8 @@ Obtains information about the second-level album or files in asynchronous mode.
- Parameters
- Parameters
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| --- | --- | --- | -- |
| --- | --- | --- | -- |
| path | string | Yes| URI of the directory to query.|
| path | promise<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**.|
| type | promise<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:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- **offset**: position to start the query. The value is a number.<br>- **count**: number of files to query.|
| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- **offset**: position to start the query. The value is a number.<br>- **count**: number of files to query.|
- Return value
- Return value
...
@@ -128,8 +130,8 @@ Obtains information about the second-level album or files in asynchronous mode.
...
@@ -128,8 +130,8 @@ Obtains information about the second-level album or files in asynchronous mode.
| path | string | Yes | URI of the directory to query. |
| path | promise<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**.|
| type | promise<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:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- **offset**: position to start the query. The value is a number.<br>- **count**: number of files to query.|
| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- **offset**: position to start the query. The value is a number.<br>- **count**: number of files to query.|
| callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. |
| callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. |
- Error
- Error
...
@@ -156,7 +158,7 @@ Obtains information about the second-level album or files in asynchronous mode.
...
@@ -156,7 +158,7 @@ Obtains information about the second-level album or files in asynchronous mode.
Creates a file in the specified path in asynchronous mode. This API uses a promise to return the result.
Creates a file in the specified path in asynchronous mode. This API uses a promise to return the result.
...
@@ -165,8 +167,8 @@ Creates a file in the specified path in asynchronous mode. This API uses a promi
...
@@ -165,8 +167,8 @@ Creates a file in the specified path in asynchronous mode. This API uses a promi
- Parameters
- Parameters
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| --- | --- | --- | -- |
| --- | --- | --- | -- |
| filename | string | Yes| Name of the file to create.|
| filename | promise<string>| Yes| Name of the file to create.|
| path | string | Yes| URI of the file to create.|
| path | promise<string>| Yes| URI of the file to create.|
| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
- Return value
- Return value
...
@@ -209,8 +211,8 @@ Creates a file in the specified path in asynchronous mode. This API uses a callb
...
@@ -209,8 +211,8 @@ Creates a file in the specified path in asynchronous mode. This API uses a callb
| filename | string | Yes | Name of the file to create. |
| filename | promise<string> | Yes | Name of the file to create. |
| path | string | Yes | URI of the file to create. |
| path | promise<string> | Yes | URI of the file to create. |
| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
| options | Object | No| The options are as follows:<br>- **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. |
| callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. |
...
@@ -246,9 +248,9 @@ Defines the file information returned by **getRoot()** or **listFile()**.
...
@@ -246,9 +248,9 @@ Defines the file information returned by **getRoot()** or **listFile()**.
| Name| Type| Readable| Writable| Description|
| Name| Type| Readable| Writable| Description|
| --- | -- | -- | -- | -- |
| --- | -- | -- | -- | -- |
| name | string | Yes| No| File name.|
| name | promise<string>| Yes| No| File name.|
| path | string | Yes| No| URI of the file.|
| path | promise<string>| Yes| No| URI of the file.|
| type | string | Yes| No| File type.|
| type | promise<string>| Yes| No| File type.|
| size | number | Yes| No| File size.|
| size | number | Yes| No| File size.|
| addedTime | number | Yes| No| Time when the file was scanned to the database.|
| addedTime | number | Yes| No| Time when the file was scanned to the database.|
| modifiedTime | number | Yes| No| Time when the file was modified.|
| modifiedTime | number | Yes| No| Time when the file was modified.|
...
@@ -263,4 +265,4 @@ Defines the device type.
...
@@ -263,4 +265,4 @@ Defines the device type.
| Name| Type | Readable| Writable| Description |
| Name| Type | Readable| Writable| Description |
| ------ | ------ | ---- | ---- | -------- |
| ------ | ------ | ---- | ---- | -------- |
| name | string | Yes | Yes | Device name.|
| name | promise<string>| Yes | Yes | Device name.|
> 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.
This module provides functions related to file security levels. It provides JS APIs to obtain and set file security levels.
The APIs of this module can be used to obtain and set file security levels.
## Modules to Import
## Modules to Import
...
@@ -64,7 +64,7 @@ Sets the security label for a file in asynchronous mode. This API uses a promise
...
@@ -64,7 +64,7 @@ Sets the security label for a file in asynchronous mode. This API uses a promise
> - The initial APIs of this module are supported since API version 8. 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 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - API version 9 is a canary release for trial use. The APIs of this version may be unstable.
> - API version 9 is a canary version for trial use. The APIs of this version may be unstable.
The APIs of this module can be used to obtain storage space information, including the space of built-in and plug-in memory cards, space occupied by different types of data, and space of application data.
## Modules to Import
## Modules to Import
...
@@ -15,10 +17,14 @@ import storagestatistics from "@ohos.storageStatistics";
...
@@ -15,10 +17,14 @@ import storagestatistics from "@ohos.storageStatistics";
**System API**: This is a system API and cannot be called by third-party applications.
- Parameters
| Name | Type | Mandatory| Description|
| ---------- | ------ | ---- | ---- |
| userId | string | No | User ID.<br>Value:<br>- Set this parameter to the ID of the user to be queried.<br>- If no value is specified, information about the current user is queried.|
- Return value
| Type | Description |
| --------------------- | ---------------- |
| Promise<[StorageStats](#StorageStats)> | Promise used to return the information obtained.|
| userId | string | No | User ID.<br>Value:<br>- Set this parameter to the ID of the user to be queried.<br>- If no value is specified, information about the current user is queried. |
| callback | callback:AsyncCallback<[StorageStats](#StorageStats)> | Yes | Callback invoked to return the information obtained.|
> - The initial APIs of this module are supported since API version 9.
> - The initial APIs of this module are supported since API version 9.
> - API version 9 is a canary release for trial use. The APIs of this version may be unstable.
> - API version 9 is a canary version for trial use. The APIs of this version may be unstable.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
The APIs of this module can be used to perform volume and disk management, including obtaining volume information, mounting and unmounting volumes, partitioning disks, and formatting volumes.
## Modules to Import
## Modules to Import
...
@@ -15,7 +18,7 @@ import volumemanager from "@ohos.volumeManager";
...
@@ -15,7 +18,7 @@ import volumemanager from "@ohos.volumeManager";