提交 6d6bd599 编写于 作者: A annie_wangli

update docs

Signed-off-by: Nannie_wangli <annie.wangli@huawei.com>
上级 3b5f17c9
......@@ -19,7 +19,7 @@
- [Media](js-apis-media.md)
- Security
- [User Authentication](js-apis-useriam-userauth.md)
- [Access Control](js-apis-abilityAccessCtrl.md)
- [Access Control](js-apis-abilityAccessCtrl.md)
- Data Management
- [File Management](js-apis-fileio.md)
- [Lightweight Storage](js-apis-data-storage.md)
......@@ -27,8 +27,16 @@
- [Relational Database](js-apis-data-rdb.md)
- [Result Set](js-apis-data-resultset.md)
- [DataAbilityPredicates](js-apis-data-ability.md)
- File Management
- [File Management](js-apis-fileio.md)
- [Statfs](js-apis-statfs.md)
- [Environment](js-apis-environment.md)
- [Public File Access and Management](js-apis-filemanager.md)
- [App Storage Statistics](js-apis-storage-statistics.md)
- [Volume Management](js-apis-volumemanager.md)
- Account Management
- [Distributed Account Management](js-apis-distributed-account.md)
- [App Account Management](js-apis-appAccount.md)
- Telephony Service
- [Call](js-apis-call.md)
- [SMS](js-apis-sms.md)
......@@ -38,7 +46,7 @@
- [WLAN](js-apis-wifi.md)
- Device Management
- [Sensors](js-apis-sensor.md)
- [Vibration](js-apis-vibrator.md)
- [Vibrator](js-apis-vibrator.md)
- [Brightness](js-apis-brightness.md)
- [Battery Info](js-apis-battery-info.md)
- [Power Management](js-apis-power.md)
......
# App Storage Statistics
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> 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
```js
import storagestatistics from "@ohos.storagestatistics";
```
## System Capabilities
SystemCapability.FileManagement.StorageService.SpatialStatistics
## storagestatistics.getTotalSizeOfVolume
getTotalSizeOfVolume(volumeUuid: string): Promise&lt;number&gt;
Asynchronously obtains the total space of the specified volume. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------ | ---- | ---- |
| volumeUuid | string | Yes| Universally unique identifier (UUID) of the volume.|
- Return value
| Type| Description|
| --------------------- | ---------------- |
| Promise&lt;number&gt; | Promise used to return the total space of the volume.|
- Example
```js
let uuid = "";
storagestatistics.getTotalSizeOfVolume(uuid).then(function(number){
console.info("getTotalSizeOfVolume successfully:"+ number);
}).catch(function(err){
console.info("getTotalSizeOfVolume failed with error:"+ err);
});
```
## storagestatistics.getTotalSizeOfVolume
getTotalSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):void
Asynchronously obtains the total space of the specified volume. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------------------------------------ | ---- | -------------------------- |
| volumeUuid | string | Yes| UUID of the volume.|
| callback | callback:AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the total space of the volume.|
- Example
```js
let uuid = "";
storagestatistics.getTotalSizeOfVolume(uuid, function(error, number){
// Do something
});
```
## storagestatistics.getFreeSizeOfVolume
getFreeSizeOfVolume(volumeUuid: string): Promise&lt;number&gt;
Asynchronously obtains the available space of the specified volume. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------ | ---- | ---- |
| volumeUuid | string | Yes| UUID of the volume.|
- Return value
| Type| Description|
| --------------------- | ------------------ |
| Promise&lt;number&gt; | Promise used to return the available space of the volume.|
- Example
```js
let uuid = "";
storagestatistics.getFreeSizeOfVolume(uuid).then(function(number){
console.info("getFreeSizeOfVolume successfully:"+ number);
}).catch(function(err){
console.info("getFreeSizeOfVolume failed with error:"+ err);
});
```
## storagestatistics.getFreeSizeOfVolume
getFreeSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):void
Asynchronously obtains the available space of the specified volume. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------------------------------------ | ---- | ---------------------------- |
| volumeUuid | string | Yes| UUID of the volume.|
| callback | callback:AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the available space of the volume.|
- Example
```js
let uuid = "";
storagestatistics.getFreeSizeOfVolume(uuid, function(error, number){
// Do something
});
```
## storagestatistics.getBundleStats
getBundleStats(volumeUuid: string, packageName:String, ): Promise&lt;BundleStats&gt;
Asynchronously obtains the bundle status on the specified volume. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ----------- | ------ | ---- | -------- |
| volumeUuid | string | Yes| UUID of the volume.|
| packageName | string | Yes| Bundle name of the app.|
- Return value
| Type| Description|
| ------------------------------------------ | -------------------------- |
| Promise&lt;[Bundlestats](#bundlestats)&gt; | Promise used to return the bundle status on the volume.|
- Example
```js
let uuid = "";
let packageName = "";
storagestatistics.getBundleStats(uuid, packageName).then(function(BundleStats){
console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats));
}).catch(function(err){
console.info("getBundleStats failed with error:"+ err);
});
```
## storagestatistics.getBundleStats
getBundleStats(volumeUuid: string, callback:AsyncCallback&lt;BundleStats&gt;):void
Asynchronously obtains the bundle status on the specified volume. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | --------------------------------------------------------- | ---- | ------------------------------------ |
| volumeUuid | string | Yes| UUID of the volume.|
| callback | callback:AsyncCallback&lt;[Bundlestats](#bundlestats)&gt; | Yes| Callback invoked to return the bundle status on the volume.|
- Example
```js
let uuid = "";
let packageName = "";
storagestatistics.getBundleStats(uuid, packageName, function(error, BundleStats){
// Do something
});
```
## BundleStats
### Attributes
| Name| Type| Description|
| --------- | ------ | -------------- |
| appSize | number | Size of the app.|
| cacheSize | number | Size of the cached data.|
| dataSize | number | Total data size of the app.|
# Volume Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> 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
```js
import volumemanager from "@ohos.volumemanager";
```
## System Capabilities
SystemCapability.FileManagement.StorageService.Volume
## volumemanager.getAllVolumes
getAllVolumes(): Promise&lt;Volume[]&gt;
Asynchronously obtains information about all available volumes. This method uses a promise to return the result.
- Return value
| Type| Description|
| ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)[]&gt; | Promise used to return the execution result.|
- Example
```js
volumemanager.getAllVolumes().then(function(volumes){
// do something
});
```
## volumemanager.getAllVolumes
getAllVolumes(callback:AsyncCallback&lt;Volume[]&gt;):void
Asynchronously obtains information about all available volumes. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------------------------------------------------- | ---- | ------------------------------------ |
| callback | callback:AsyncCallback&lt;[Volume](#volume)[]&gt; | Yes| Callback invoked to return the volume information obtained.|
- Example
```js
let uuid = "";
volumemanager.getAllVolumes(uuid, function(error, volumes){
// do something
});
```
## volumemanager.mount
mount(volumeId: string): Promise&lt;boolean&gt;
Asynchronously mounts a volume. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------ | ---- | ---- |
| volumeId | string | Yes| Volume ID.|
- Return value
| Type| Description|
| ---------------------- | ---------- |
| Promise&lt;boolean&gt; | Promise used to return the execution result.|
- Example
```js
let volumeId = "";
volumemanager.mount(volumeId).then(function(flag){
// do something
});
```
## volumemanager.mount
mount(volumeId: string, callback:AsyncCallback&lt;boolean&gt;):void
Asynchronously mounts a volume. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes| Volume ID.|
| callback | callback:AsyncCallback&lt;boolean&gt; | Yes| Callback invoked to return the execution result.|
- Example
```js
let volumeId = "";
volumemanager.mount(volumeId, function(error, flag){
// do something
});
```
## volumemanager.unmount
unmount(volumeId: string): Promise&lt;boolean&gt;
Asynchronously unmounts a volume. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------ | ---- | ---- |
| volumeId | string | Yes| Volume ID.|
- Return value
| Type| Description|
| ---------------------- | ---------- |
| Promise&lt;boolean&gt; | Promise used to return the execution result.|
- Example
```js
let volumeId = "";
volumemanager.unmount(volumeId).then(function(flag){
// do something
});
```
## volumemanager.unmount
unmount(volumeId: string, callback:AsyncCallback&lt;boolean&gt;):void
Asynchronously unmounts a volume. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes| Volume ID.|
| callback | callback:AsyncCallback&lt;boolean&gt; | Yes| Callback invoked to return the execution result.|
- Example
```js
let volumeId = "";
volumemanager.unmount(volumeId, function(error, flag){
// do something
});
```
## Volume
### Attributes
| Name| Type| Description|
| ----------- | ------- | -------------------- |
| id | number | Volume ID.|
| uuid | string | Universally unique identifier (UUID) of the volume.|
| description | string | Description of the volume.|
| removeAble | boolean | Whether the volume is a removable storage device.|
| state | int | Current volume status.|
| path | string | Mount address of the volume.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册