未验证 提交 87cee909 编写于 作者: O openharmony_ci 提交者: Gitee

!6778 【翻译完成】#I5G22E

Merge pull request !6778 from Annie_wang/PR6504
# User File Access and Management
The fileManager module provides 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.
>**NOTE**<br/>
>
>- 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**.
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
```js
......
# Security Label
The secuityLabel module provides APIs to manage file data security levels, including obtaining and setting file data security levels.
> **NOTE**<br/>
> 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.
Manages file data security levels, including obtaining and setting file data security levels.
## Modules to Import
```js
......
# statfs
> **NOTE:**<br>
> 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 statfs module provides APIs for obtaining file system information, including the total number of bytes and the number of idle bytes of the file system.
Obtains file system information, including the total number of bytes and the number of idle bytes of the file system.
> **NOTE**<br>
> 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.
## Modules to Import
......@@ -63,7 +63,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
let context = featureAbility.getContext();
context.getFilesDir().then(function (path) {
statfs.getFreeBytes(path, function(err, number){
console.info("getFreeBytes callback successfully:"+ number);
console.info("Got free bytes successfully:"+ number);
});
});
```
......@@ -121,7 +121,7 @@ Obtains the total number of bytes of the specified file system in asynchronous m
let context = featureAbility.getContext();
context.getFilesDir().then(function (path) {
statfs.getTotalBytes(path, function(err, number){
console.info("getTotalBytes callback successfully:"+ number);
console.info("Got total bytes successfully:"+ number);
});
});
```
# App Storage Statistics
The storageStatistics module provides APIs for obtaining 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.
> **NOTE**<br/>
>
> - 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 version for trial use. The APIs of this version may be unstable.
Obtains 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
```js
......
# Volume Management
The volumeManager module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting volumes, partitioning disks, and formatting volumes.
> **NOTE**<br>
>
> - The initial APIs of this module are supported since API version 9.
> - 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.
Performs volume and disk management, including obtaining volume information, mounting and unmounting volumes, partitioning disks, and formatting volumes.
## Modules to Import
```js
......@@ -59,7 +59,7 @@ Asynchronously obtains information about all available volumes. This API uses a
```js
let uuid = "";
volumemanager.getAllVolumes(function(error, volumes){
// Do something.
// Do something
});
```
......@@ -91,7 +91,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result.
```js
let volumeId = "";
volumemanager.mount(volumeId).then(function(flag){
// Do something.
// Do something
});
```
......@@ -117,7 +117,7 @@ Asynchronously obtains the available space of the specified volume. This API use
```js
let volumeId = "";
volumemanager.mount(volumeId, function(error, flag){
// Do something.
// Do something
});
```
......@@ -148,7 +148,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result.
```js
let volumeId = "";
volumemanager.unmount(volumeId).then(function(flag){
// Do something.
// Do something
});
```
......@@ -174,7 +174,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
```js
let volumeId = "";
volumemanager.unmount(volumeId, function(error, flag){
// Do something.
// Do something
});
```
......@@ -182,7 +182,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
getVolumeByUuid(uuid: string): Promise&lt;Volume&gt;
Asynchronously obtains volume information based on the Universally unique identifier (UUID). This API uses a promise to return the result.
Asynchronously obtains volume information based on the universally unique identifier (UUID). This API uses a promise to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER
......@@ -198,7 +198,7 @@ Asynchronously obtains volume information based on the Universally unique identi
| Type | Description |
| ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)&gt; | Promise used to return the execution result.|
| Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.|
**Example**
......@@ -229,7 +229,7 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal
```js
let uuid = "";
volumemanager.getVolumeByUuid(uuid, (error, volume) => {
// Do something.
// Do something.
});
```
......@@ -253,7 +253,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses
| Type | Description |
| ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)&gt; | Promise used to return the execution result.|
| Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.|
**Example**
......@@ -284,7 +284,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses
```js
let id = "";
volumemanager.getVolumeById(id, (error, volume) => {
// Do something.
// Do something.
});
```
......@@ -309,7 +309,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr
| Type | Description |
| ---------------------- | -------------------------- |
| Promise&lt;void&gt; | Promise used to return the volume description. |
| Promise&lt;void&gt; | Promise used to return the result. |
**Example**
......@@ -335,7 +335,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca
| ---------- | --------------------------------------- | ---- | ---------------- |
| uuid | string | Yes | UUID of the volume. |
| description | string | Yes | Volume description. |
| callback | callback:AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the volume description.|
| callback | callback:AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result.|
**Example**
......@@ -343,7 +343,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca
let uuid = "";
let description = "";
volumemanager.setVolumeDescription(uuid, description, (error, bool) => {
// Do something.
// Do something.
});
```
......@@ -398,7 +398,7 @@ Asynchronously formats a volume. This API uses a callback to return the result.
```js
let volId = "";
volumemanager.format(volId, (error, bool) => {
// Do something.
// Do something.
});
```
......@@ -457,7 +457,7 @@ Asynchronously partitions a disk. This API uses a callback to return the result.
let volId = "";
let fstype = "";
volumemanager.format(volId, fstype, (error, bool) => {
// Do something.
// Do something.
});
```
......@@ -473,5 +473,5 @@ Asynchronously partitions a disk. This API uses a callback to return the result.
| uuid | string | UUID of the volume. |
| description | string | Description of the volume. |
| removable | boolean | Whether the volume is a removable storage device.|
| state | number | Current volume status. |
| state | number | Volume state. |
| path | string | Mount address of the volume. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册