Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Coping0606
Docs
提交
b0f4396b
D
Docs
项目概览
Coping0606
/
Docs
与 Fork 源项目一致
Fork自
OpenHarmony / Docs
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b0f4396b
编写于
7月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6421 【翻译完成】#I5EYET
Merge pull request !6421 from Annie_wang/PR6168
上级
c4178049
3b910fe4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
321 addition
and
26 deletion
+321
-26
en/application-dev/reference/apis/js-apis-volumemanager.md
en/application-dev/reference/apis/js-apis-volumemanager.md
+321
-26
未找到文件。
en/application-dev/reference/apis/js-apis-volumemanager.md
浏览文件 @
b0f4396b
...
@@ -20,19 +20,21 @@ getAllVolumes(): Promise<Array<Volume>>
...
@@ -20,19 +20,21 @@ getAllVolumes(): Promise<Array<Volume>>
Asynchronously obtains information about all available volumes. This API uses a promise to return the result.
Asynchronously obtains information about all available volumes. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.STORAGE_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
-
Return value
**Return value**
| Type | Description |
| Type | Description |
| ---------------------------------- | -------------------------- |
| ---------------------------------- | -------------------------- |
| Promise
<
[Volume](#volume)[]
>
| Promise used to return the execution result.|
| Promise
<
[Volume](#volume)[]
>
| Promise used to return the execution result.|
-
Example
**Example**
```
js
```
js
volumemanager
.
getAllVolumes
().
then
(
function
(
volumes
){
volumemanager
.
getAllVolumes
().
then
(
function
(
volumes
){
//
do something
//
Do something.
});
});
```
```
...
@@ -42,20 +44,22 @@ getAllVolumes(callback: AsyncCallback<Array<Volume>>): void
...
@@ -42,20 +44,22 @@ getAllVolumes(callback: AsyncCallback<Array<Volume>>): void
Asynchronously obtains information about all available volumes. This API uses a callback to return the result.
Asynchronously obtains information about all available volumes. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.STORAGE_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
-
Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------------------------ |
| -------- | ------------------------------------------------- | ---- | ------------------------------------ |
| callback | callback:AsyncCallback
<
[Volume](#volume)[]
>
| Yes | Callback invoked to return the volume information obtained.|
| callback | callback:AsyncCallback
<
[Volume](#volume)[]
>
| Yes | Callback invoked to return the volume information obtained.|
-
Example
**Example**
```
js
```
js
let
uuid
=
""
;
let
uuid
=
""
;
volumemanager
.
getAllVolumes
(
function
(
error
,
volumes
){
volumemanager
.
getAllVolumes
(
function
(
error
,
volumes
){
//
do something
//
Do something.
});
});
```
```
...
@@ -66,26 +70,28 @@ mount(volumeId: string): Promise<boolean>
...
@@ -66,26 +70,28 @@ mount(volumeId: string): Promise<boolean>
Asynchronously mounts a volume. This API uses a promise to return the result.
Asynchronously mounts a volume. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.MOUNT_UNMOUNT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
-
Parameters
**Parameters**
| Name | Type | Mandatory| Description|
| Name | Type | Mandatory| Description|
| -------- | ------ | ---- | ---- |
| -------- | ------ | ---- | ---- |
| volumeId | string | Yes | Volume ID.|
| volumeId | string | Yes | Volume ID.|
-
Return value
**Return value**
| Type | Description |
| Type | Description |
| ---------------------- | ---------- |
| ---------------------- | ---------- |
| Promise
<
boolean
>
| Promise used to return the execution result.|
| Promise
<
boolean
>
| Promise used to return the execution result.|
-
Example
**Example**
```
js
```
js
let
volumeId
=
""
;
let
volumeId
=
""
;
volumemanager
.
mount
(
volumeId
).
then
(
function
(
flag
){
volumemanager
.
mount
(
volumeId
).
then
(
function
(
flag
){
//
do something
//
Do something.
});
});
```
```
...
@@ -95,21 +101,23 @@ mount(volumeId: string, callback:AsyncCallback<boolean>):void
...
@@ -95,21 +101,23 @@ mount(volumeId: string, callback:AsyncCallback<boolean>):void
Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result.
Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.MOUNT_UNMOUNT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
-
Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------- |
| -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes | Volume ID. |
| volumeId | string | Yes | Volume ID. |
| callback | callback:AsyncCallback
<
boolean
>
| Yes | Callback invoked to return the execution result.|
| callback | callback:AsyncCallback
<
boolean
>
| Yes | Callback invoked to return the execution result.|
-
Example
**Example**
```
js
```
js
let
volumeId
=
""
;
let
volumeId
=
""
;
volumemanager
.
mount
(
volumeId
,
function
(
error
,
flag
){
volumemanager
.
mount
(
volumeId
,
function
(
error
,
flag
){
//
do something
//
Do something.
});
});
```
```
...
@@ -119,26 +127,28 @@ unmount(volumeId: string): Promise<boolean>
...
@@ -119,26 +127,28 @@ unmount(volumeId: string): Promise<boolean>
Asynchronously unmounts a volume. This API uses a promise to return the result.
Asynchronously unmounts a volume. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.MOUNT_UNMOUNT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
-
Parameters
**Parameters**
| Name | Type | Mandatory| Description|
| Name | Type | Mandatory| Description|
| -------- | ------ | ---- | ---- |
| -------- | ------ | ---- | ---- |
| volumeId | string | Yes | Volume ID.|
| volumeId | string | Yes | Volume ID.|
-
Return value
**Return value**
| Type | Description |
| Type | Description |
| ---------------------- | ---------- |
| ---------------------- | ---------- |
| Promise
<
boolean
>
| Promise used to return the execution result.|
| Promise
<
boolean
>
| Promise used to return the execution result.|
-
Example
**Example**
```
js
```
js
let
volumeId
=
""
;
let
volumeId
=
""
;
volumemanager
.
unmount
(
volumeId
).
then
(
function
(
flag
){
volumemanager
.
unmount
(
volumeId
).
then
(
function
(
flag
){
//
do something
//
Do something.
});
});
```
```
...
@@ -148,21 +158,306 @@ unmount(volumeId: string, callback:AsyncCallback<boolean>):void
...
@@ -148,21 +158,306 @@ unmount(volumeId: string, callback:AsyncCallback<boolean>):void
Asynchronously unmounts a volume. This API uses a callback to return the result.
Asynchronously unmounts a volume. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.MOUNT_UNMOUNT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
-
Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------- |
| -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes | Volume ID. |
| volumeId | string | Yes | Volume ID. |
| callback | callback:AsyncCallback
<
boolean
>
| Yes | Callback invoked to return the execution result.|
| callback | callback:AsyncCallback
<
boolean
>
| Yes | Callback invoked to return the execution result.|
-
Example
**Example**
```
js
```
js
let
volumeId
=
""
;
let
volumeId
=
""
;
volumemanager
.
unmount
(
volumeId
,
function
(
error
,
flag
){
volumemanager
.
unmount
(
volumeId
,
function
(
error
,
flag
){
// do something
// Do something.
});
```
## volumemanager.getVolumeByUuid
getVolumeByUuid(uuid: string): Promise
<
Volume
>
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
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description|
| -------- | ------ | ---- | ---- |
| uuid | string | Yes | UUID of the volume.|
**Return value**
| Type | Description |
| ---------------------------------- | -------------------------- |
| Promise
<
[Volume](#volume)
>
| Promise used to return the execution result.|
**Example**
```
js
let
uuid
=
""
;
let
volume
=
await
volumemanager
.
getVolumeByUuid
(
uuid
);
```
## volumemanager.getVolumeByUuid
getVolumeByUuid(uuid: string, callback: AsyncCallback
<
Volume
>
): void
Asynchronously obtains volume information based on the UUID. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.STORAGE_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------- |
| uuid | string | Yes | UUID of the volume. |
| callback | callback:AsyncCallback
<
[Volume](#volume)
>
| Yes | Callback invoked to return the volume information obtained.|
**Example**
```
js
let
uuid
=
""
;
volumemanager
.
getVolumeByUuid
(
uuid
,
(
error
,
volume
)
=>
{
// Do something.
});
```
## volumemanager.getVolumeById
getVolumeById(id: string): Promise
<
Volume
>
Asynchronously obtains volume information based on the volume ID. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.STORAGE_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory | Description|
| -------- | ------ | ---- | ---- |
| id | string | Yes | Volume ID.|
**Return value**
| Type | Description |
| ---------------------------------- | -------------------------- |
| Promise
<
[Volume](#volume)
>
| Promise used to return the execution result.|
**Example**
```
js
let
id
=
""
;
let
volume
=
await
volumemanager
.
getVolumeById
(
id
);
```
## volumemanager.getVolumeById
getVolumeById(id: string, callback: AsyncCallback
<
Volume
>
): void
Asynchronously obtains volume information based on the volume ID. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.STORAGE_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------- |
| id | string | Yes | Volume ID. |
| callback | callback:AsyncCallback
<
[Volume](#volume)
>
| Yes | Callback invoked to return the volume information obtained.|
**Example**
```
js
let
id
=
""
;
volumemanager
.
getVolumeById
(
id
,
(
error
,
volume
)
=>
{
// Do something.
});
```
## volumemanager.setVolumeDescription
setVolumeDescription(uuid: string, description: string): Promise
<
void
>
Asynchronously sets the volume description based on the UUID. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.MOUNT_UNMOUNT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description|
| --------- | ------ | ---- | ---- |
| uuid | string | Yes | UUID of the volume.|
| description | string | Yes | Volume description.|
**Return value**
| Type | Description |
| ---------------------- | -------------------------- |
| Promise
<
void
>
| Promise used to return the volume description. |
**Example**
```
js
let
uuid
=
""
;
let
description
=
""
;
let
bool
=
await
volumemanager
.
setVolumeDescription
(
uuid
,
description
);
```
## volumemanager.setVolumeDescription
setVolumeDescription(uuid: string, description: string, callback: AsyncCallback
<
void
>
): void
Asynchronously sets the volume description based on the UUID. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.MOUNT_UNMOUNT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | ---------------- |
| uuid | string | Yes | UUID of the volume. |
| description | string | Yes | Volume description. |
| callback | callback:AsyncCallback
<
void
>
| Yes | Callback invoked to return the volume description.|
**Example**
```
js
let
uuid
=
""
;
let
description
=
""
;
volumemanager
.
setVolumeDescription
(
uuid
,
description
,
(
error
,
bool
)
=>
{
// Do something.
});
```
## volumemanager.format
format(volId: string): Promise
<
void
>
Asynchronously formats a volume. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.MOUNT_FORMAT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description|
| ----------- | ------ | ---- | ---- |
| volId | string | Yes | Volume ID.|
**Return value**
| Type | Description |
| --------------------- | ----------------------- |
| Promise
<
void
>
| Promise used to return the result. |
**Example**
```
js
let
volId
=
""
;
let
bool
=
await
volumemanager
.
format
(
volId
);
```
## volumemanager.format
format(volId: string, callback: AsyncCallback
<
void
>
): void
Asynchronously formats a volume. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.MOUNT_FORMAT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------------- |
| volId | string | Yes | Volume ID. |
| callback | callback:AsyncCallback
<
void
>
| Yes | Callback invoked to return the result. |
**Example**
```
js
let
volId
=
""
;
volumemanager
.
format
(
volId
,
(
error
,
bool
)
=>
{
// Do something.
});
```
## volumemanager.partition
partition(volId: string, fstype: string): Promise
<
void
>
Asynchronously partitions a disk. This API uses a promise to return the result.
**Required permissions**
: ohos.permission.MOUNT_FORMAT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description|
| ----------- | ------ | ---- | ---- |
| volId | string | Yes | ID of the disk to which the volume belongs.|
| fstype | string | Yes | Partition type. |
**Return value**
| Type | Description |
| --------------------- | ----------------------- |
| Promise
<
void
>
| Promise used to return the result. |
**Example**
```
js
let
volId
=
""
;
let
fstype
=
""
;
let
bool
=
await
volumemanager
.
partition
(
volId
,
fstype
);
```
## volumemanager.partition
partition(volId: string, fstype : string, callback: AsyncCallback
<
void
>
): void
Asynchronously partitions a disk. This API uses a callback to return the result.
**Required permissions**
: ohos.permission.MOUNT_FORMAT_MANAGER
**System capability**
: SystemCapability.FileManagement.StorageService.Volume
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------------- |
| volId | string | Yes | ID of the disk to which the volume belongs. |
| fstype | string | Yes | Partition type. |
| callback | callback:AsyncCallback
<
void
>
| Yes | Callback invoked to return the result. |
**Example**
```
js
let
volId
=
""
;
let
fstype
=
""
;
volumemanager
.
format
(
volId
,
fstype
,
(
error
,
bool
)
=>
{
// Do something.
});
});
```
```
...
@@ -172,11 +467,11 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
...
@@ -172,11 +467,11 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
### Attributes
### Attributes
| Name | Type | Description |
| Name
| Type | Description |
| ----------- | ------- | -------------------- |
| ----------- | ------- | -------------------- |
| id |
number
| Volume ID. |
| id |
string
| Volume ID. |
| uuid | string | U
niversally unique identifier (UUID)
of the volume. |
| uuid | string | U
UID
of the volume. |
| description | string | Description of the volume. |
| description | string | Description of the volume. |
| removable | boolean | Whether the volume is a removable storage device.|
| removable
| boolean | Whether the volume is a removable storage device.|
| state |
int
| Current volume status. |
| state |
number
| Current volume status. |
| path | string | Mount address of the volume. |
| path | string | Mount address of the volume. |
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录