Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
1d0dce03
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
1d0dce03
编写于
6月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!19709 userFileManager.md 接口一致性和示例代码修改
Merge pull request !19709 from 胡伟奇/ufm_0614
上级
b45019dd
4572c418
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
338 addition
and
16 deletion
+338
-16
zh-cn/application-dev/reference/apis/js-apis-userFileManager.md
...application-dev/reference/apis/js-apis-userFileManager.md
+338
-16
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-userFileManager.md
浏览文件 @
1d0dce03
...
...
@@ -62,6 +62,14 @@ getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<
| options |
[
FetchOptions
](
#fetchoptions
)
| 是 | 图片和视频检索选项。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| 是 | callback返回图片和视频检索结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -111,6 +119,14 @@ getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g
| --------------------------- | -------------- |
| Promise
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| Promise对象,返回图片和视频数据结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -155,6 +171,15 @@ createPhotoAsset(displayName: string, albumUri: string, callback: AsyncCallback&
| albumUri | string | 是 | 创建的图片或者视频所在相册的uri。 |
| callback | AsyncCallback
<
[FileAsset](#fileasset)
>
| 是 | callback返回创建的图片和视频结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName or albumUri is not string. |
| 14000001 | if type displayName invalid. |
**示例:**
```
ts
...
...
@@ -197,6 +222,15 @@ createPhotoAsset(displayName: string, callback: AsyncCallback<FileAsset>):
| displayName | string | 是 | 创建的图片或者视频文件名。 |
| callback | AsyncCallback
<
[FileAsset](#fileasset)
>
| 是 | callback返回创建的图片和视频结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName is not string. |
| 14000001 | if type displayName invalid. |
**示例:**
```
ts
...
...
@@ -237,6 +271,14 @@ createPhotoAsset(displayName: string, albumUri?: string): Promise<FileAsset&g
| --------------------------- | -------------- |
| Promise
<
[FileAsset](#fileasset)
>
| Promise对象,返回创建的图片和视频结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName or albumUri is not string. |
**示例:**
```
ts
...
...
@@ -271,6 +313,15 @@ createPhotoAsset(displayName: string, createOption: PhotoCreateOptions, callback
| createOption |
[
PhotoCreateOptions
](
#photocreateoptions10
)
| 是 | 图片或视频的创建选项。 |
| callback | AsyncCallback
<
[FileAsset](#fileasset)
>
| 是 | callback返回创建的图片和视频结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName is not string. |
| 14000001 | if type displayName invalid. |
**示例:**
```
ts
...
...
@@ -314,6 +365,14 @@ createPhotoAsset(displayName: string, createOption: PhotoCreateOptions): Promise
| --------------------------- | -------------- |
| Promise
<
[FileAsset](#fileasset)
>
| Promise对象,返回创建的图片和视频结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName is not string. |
**示例:**
```
ts
...
...
@@ -341,7 +400,7 @@ createAudioAsset(displayName: string, callback: AsyncCallback<FileAsset>):
**系统能力**
:SystemCapability.FileManagement.UserFileManager.Core
**需要权限**
:ohos.permission.WRITE_
IMAGEVIDE
O
**需要权限**
:ohos.permission.WRITE_
AUDI
O
**参数:**
...
...
@@ -350,6 +409,15 @@ createAudioAsset(displayName: string, callback: AsyncCallback<FileAsset>):
| displayName | string | 是 | 创建的音频文件名。 |
| callback | AsyncCallback
<
[FileAsset](#fileasset)
>
| 是 | callback返回创建的音频资源结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName is not string. |
| 14000001 | if type displayName invalid. |
**示例:**
```
ts
...
...
@@ -375,7 +443,7 @@ createAudioAsset(displayName: string): Promise<FileAsset>;
**系统能力**
:SystemCapability.FileManagement.UserFileManager.Core
**需要权限**
:ohos.permission.WRITE_
IMAGEVIDE
O
**需要权限**
:ohos.permission.WRITE_
AUDI
O
**参数:**
...
...
@@ -389,6 +457,14 @@ createAudioAsset(displayName: string): Promise<FileAsset>;
| --------------------------- | -------------- |
| Promise
<
[FileAsset](#fileasset)
>
| Promise对象,返回创建的音频资源结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type displayName is not string. |
**示例:**
```
ts
...
...
@@ -423,6 +499,14 @@ getPhotoAlbums(options: AlbumFetchOptions, callback: AsyncCallback<FetchResul
| options |
[
AlbumFetchOptions
](
#albumfetchoptions
)
| 是 | 相册检索选项。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[Album](#album)
>>
| 是 | callback返回相册检索结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not AlbumFetchOptions. |
**示例:**
```
ts
...
...
@@ -474,6 +558,14 @@ getPhotoAlbums(options: AlbumFetchOptions): Promise<FetchResult<Album>&
| --------------------------- | -------------- |
| Promise
<
[FetchResult](#fetchresult)
<
[Album](#album)
>>
| Promise对象,返回相册检索结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not AlbumFetchOptions. |
**示例:**
```
ts
...
...
@@ -599,11 +691,13 @@ deleteAlbums(albums: Array<Album>, callback: AsyncCallback<void>): v
**示例:**
```
ts
import
dataSharePredicates
from
'
@ohos.data.dataSharePredicates
'
;
async
function
example
()
{
// 示例代码为删除
名称包含newAlbumName的第一个
相册。
// 示例代码为删除
相册名为newAlbumName的
相册。
console
.
info
(
'
deleteAlbumsDemo
'
);
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
predicates
.
like
(
'
album_name
'
,
'
%newAlbumName%
'
);
predicates
.
equalTo
(
'
album_name
'
,
'
newAlbumName
'
);
let
fetchOptions
=
{
fetchColumns
:
[],
predicates
:
predicates
...
...
@@ -648,11 +742,13 @@ deleteAlbums(albums: Array<Album>): Promise<void>;
**示例:**
```
ts
import
dataSharePredicates
from
'
@ohos.data.dataSharePredicates
'
;
async
function
example
()
{
// 示例代码为删除
名称包含newAlbumName的第一个
相册。
// 示例代码为删除
相册名为newAlbumName的
相册。
console
.
info
(
'
deleteAlbumsDemo
'
);
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
predicates
.
like
(
'
album_name
'
,
'
%newAlbumName%
'
);
predicates
.
equalTo
(
'
album_name
'
,
'
newAlbumName
'
);
let
fetchOptions
=
{
fetchColumns
:
[],
predicates
:
predicates
...
...
@@ -689,14 +785,24 @@ getAlbums(type: AlbumType, subType: AlbumSubType, options: FetchOptions, callbac
| options |
[
FetchOptions
](
#fetchoptions
)
| 是 | 检索选项。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[Album](#album)
>>
| 是 | callback返回获取相册的结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOption. |
**示例:**
```
ts
import
dataSharePredicates
from
'
@ohos.data.dataSharePredicates
'
;
async
function
example
()
{
// 示例代码中为获取相册名
中包含newAlbumName的第一个
相册。
// 示例代码中为获取相册名
为newAlbumName的
相册。
console
.
info
(
'
getAlbumsDemo
'
);
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
predicates
.
like
(
'
album_name
'
,
'
%newAlbumName%
'
);
predicates
.
equalTo
(
'
album_name
'
,
'
newAlbumName
'
);
let
fetchOptions
=
{
fetchColumns
:
[],
predicates
:
predicates
...
...
@@ -737,6 +843,14 @@ getAlbums(type: AlbumType, subType: AlbumSubType, callback: AsyncCallback<Fet
| subType |
[
AlbumSubType
](
#albumsubtype10
)
| 是 | 相册子类型。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[Album](#album)
>>
| 是 | callback返回获取相册的结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOption. |
**示例:**
```
ts
...
...
@@ -785,14 +899,24 @@ getAlbums(type: AlbumType, subType: AlbumSubType, options?: FetchOptions): Promi
| --------------------------- | -------------- |
| Promise
<
[FetchResult](#fetchresult)
<
[Album](#album)
>>
| Promise对象,返回获取相册的结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOption. |
**示例:**
```
ts
import
dataSharePredicates
from
'
@ohos.data.dataSharePredicates
'
;
async
function
example
()
{
// 示例代码中为获取相册名
中包含newAlbumName的第一个
相册。
// 示例代码中为获取相册名
为newAlbumName的
相册。
console
.
info
(
'
getAlbumsDemo
'
);
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
predicates
.
like
(
'
album_name
'
,
'
%newAlbumName%
'
);
predicates
.
equalTo
(
'
album_name
'
,
'
newAlbumName
'
);
let
fetchOptions
=
{
fetchColumns
:
[],
predicates
:
predicates
...
...
@@ -828,6 +952,14 @@ getPrivateAlbum(type: PrivateAlbumType, callback: AsyncCallback<FetchResult&l
| type |
[
PrivateAlbumType
](
#privatealbumtype
)
| 是 | 系统相册类型。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[PrivateAlbum](#privatealbum)
>>
| 是 | callback返回相册检索结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type type is not PrivateAlbumType. |
**示例:**
```
ts
...
...
@@ -866,6 +998,14 @@ getPrivateAlbum(type: PrivateAlbumType): Promise<FetchResult<PrivateAlbum&
| --------------------------- | -------------- |
| Promise
<
[FetchResult](#fetchresult)
<
[PrivateAlbum](#privatealbum)
>>
| Promise对象,返回相册检索结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type type is not PrivateAlbumType. |
**示例:**
```
ts
...
...
@@ -898,6 +1038,14 @@ getAudioAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<
| options |
[
FetchOptions
](
#fetchoptions
)
| 是 | 检索选项。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| 是 | callback返回音频检索结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -948,6 +1096,14 @@ getAudioAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g
| --------------------------- | -------------- |
| Promise
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| Promise对象,返回音频检索结果。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -993,6 +1149,14 @@ delete(uri: string, callback: AsyncCallback<void>): void;
| uri | string | 是 | 媒体文件uri。 |
| callback | AsyncCallback
<
void
>
| 是 | callback返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type uri is not string. |
**示例:**
```
ts
...
...
@@ -1048,6 +1212,14 @@ delete(uri: string): Promise<void>;
| --------------------------------------- | ----------------- |
| Promise
<
void
>
| Promise对象,返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type uri is not string. |
**示例:**
```
ts
...
...
@@ -1385,9 +1557,19 @@ on(uri: string, forSubUri: boolean, callback: Callback<ChangeData>) : void
| forSubUri | boolean | 是 | 是否模糊监听,uri为相册uri时,forSubUri 为true能监听到相册中文件的变化,如果是false只能监听相册本身变化。uri为fileAsset时,forSubUri 为true、false没有区别,uri为DefaultChangeUri时,forSubUri必须为true,如果为false将找不到该uri,收不到任何消息。 |
| callback | Callback
<
[ChangeData](#changedata10)
>
| 是 | 返回要监听的
[
ChangeData
](
#changedata10
)
。注:uri可以注册多个不同的callback监听,
[
off<sup>10+</sup>
](
#off10
)
可以关闭该uri所有监听,也可以关闭指定callback的监听。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if parameter is invalid. |
**示例:**
```
ts
import
dataSharePredicates
from
'
@ohos.data.dataSharePredicates
'
;
async
function
example
()
{
console
.
info
(
'
onDemo
'
);
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
...
...
@@ -1438,9 +1620,19 @@ async function example() {
| uri | string | 是 | FileAsset的uri, Album的uri或
[
DefaultChangeUri
](
#defaultchangeuri10
)
的值。 |
| callback | Callback
<
[ChangeData](#changedata10)
>
| 否 | 解除
[
on<sup>10+</sup>
](
#on10
)
注册时的callback的监听,不填时,解除该uri的所有监听。注:off指定注册的callback后不会进入此回调。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if parameter is invalid. |
**示例:**
```
ts
import
dataSharePredicates
from
'
@ohos.data.dataSharePredicates
'
;
async
function
example
()
{
console
.
info
(
'
offDemo
'
);
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
...
...
@@ -1557,7 +1749,7 @@ async function example() {
};
let
fetchResult
=
await
mgr
.
getPhotoAssets
(
fetchOption
);
let
fileAsset
=
await
fetchResult
.
getFirstObject
();
let
displayName
=
userFileManager
.
ImageVideoKey
.
DISPLAY_NAME
;
let
displayName
=
userFileManager
.
ImageVideoKey
.
DISPLAY_NAME
.
toString
()
;
fileAsset
.
set
(
displayName
,
'
newDisplayName1
'
);
}
catch
(
err
)
{
console
.
error
(
'
release failed. message =
'
,
err
);
...
...
@@ -1595,7 +1787,7 @@ async function example() {
};
let
fetchResult
=
await
mgr
.
getPhotoAssets
(
fetchOption
);
let
fileAsset
=
await
fetchResult
.
getFirstObject
();
let
displayName
=
userFileManager
.
ImageVideoKey
.
DISPLAY_NAME
;
let
displayName
=
userFileManager
.
ImageVideoKey
.
DISPLAY_NAME
.
toString
()
;
let
fileAssetDisplayName
=
fileAsset
.
get
(
displayName
);
console
.
info
(
'
fileAsset get fileAssetDisplayName =
'
,
fileAssetDisplayName
);
fileAsset
.
set
(
displayName
,
'
newDisplayName2
'
);
...
...
@@ -1640,7 +1832,7 @@ async function example() {
};
let
fetchResult
=
await
mgr
.
getPhotoAssets
(
fetchOption
);
let
fileAsset
=
await
fetchResult
.
getFirstObject
();
let
displayName
=
userFileManager
.
ImageVideoKey
.
DISPLAY_NAME
;
let
displayName
=
userFileManager
.
ImageVideoKey
.
DISPLAY_NAME
.
toString
()
;
let
fileAssetDisplayName
=
fileAsset
.
get
(
displayName
);
console
.
info
(
'
fileAsset get fileAssetDisplayName =
'
,
fileAssetDisplayName
);
fileAsset
.
set
(
displayName
,
'
newDisplayName3
'
);
...
...
@@ -2060,6 +2252,15 @@ setHidden(hiddenState: boolean, callback: AsyncCallback<void>): void
| hiddenState | boolean | 是 | 是否设置为隐藏文件,true:将文件资产放入隐藏相册;false:从隐藏相册中恢复。 |
| callback | AsyncCallback
<
void
>
| 是 | callback返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
和
[
通用错误码
](
../errorcodes/errorcode-universal.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 202 | Called by non-system application. |
| 13900020 | if parameter is invalid. |
**示例:**
```
ts
...
...
@@ -2108,6 +2309,15 @@ setHidden(hiddenState: boolean): Promise<void>
| ------------------- | ---------- |
| Promise
<
void
>
| Promise对象,返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
和
[
通用错误码
](
../errorcodes/errorcode-universal.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 202 | Called by non-system application. |
| 13900020 | if parameter is invalid. |
**示例:**
```
ts
...
...
@@ -2198,7 +2408,7 @@ async function example() {
const
fetchCount
=
fetchResult
.
getCount
();
console
.
info
(
'
count:
'
+
fetchCount
);
let
fileAsset
=
await
fetchResult
.
getLastObject
();
if
(
!
fetchResult
.
isAfterLast
())
{
if
(
fetchResult
.
isAfterLast
())
{
console
.
info
(
'
fileAsset isAfterLast displayName =
'
,
fileAsset
.
displayName
);
}
else
{
console
.
info
(
'
fileAsset not isAfterLast
'
);
...
...
@@ -2464,6 +2674,14 @@ getPositionObject(index: number, callback: AsyncCallback<T>): void
| index | number | 是 | 要获取的文件的索引,从0开始。 |
| callback | AsyncCallback
<
T
>
| 是 | 异步返回指定索引的文件资产的回调。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type index is not number. |
**示例:**
```
ts
...
...
@@ -2507,6 +2725,14 @@ getPositionObject(index: number): Promise<T>
| --------------------------------------- | ----------------- |
| Promise
<
T
>
| Promise对象,返回结果集中指定索引的一个对象。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type index is not number. |
**示例:**
```
ts
...
...
@@ -2604,8 +2830,8 @@ async function example() {
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------ | ------ | ---- | ---- | ------- |
| albumType
<sup>
8
+
</sup>
|
[
AlbumType
](
#albumtype10
)
| 是 | 否 | 相册类型。 |
| albumSubType
<sup>
8
+
</sup>
|
[
AlbumSubType
](
#albumsubtype10
)
| 是 | 否 | 相册子类型。 |
| albumType
<sup>
10
+
</sup>
|
[
AlbumType
](
#albumtype10
)
| 是 | 否 | 相册类型。 |
| albumSubType
<sup>
10
+
</sup>
|
[
AlbumSubType
](
#albumsubtype10
)
| 是 | 否 | 相册子类型。 |
| albumName | string | 是 | 用户相册可写,预置相册不可写 | 相册名称。 |
| albumUri | string | 是 | 否 | 相册Uri。 |
| count | number | 是 | 否 | 相册中文件数量。 |
...
...
@@ -2628,6 +2854,14 @@ getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<
| options |
[
FetchOptions
](
#fetchoptions
)
| 是 | 检索选项。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| 是 | callback返回图片和视频数据结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -2678,6 +2912,14 @@ getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g
| --------------------------------------- | ----------------- |
| Promise
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| Promise对象,返回图片和视频数据结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -2803,6 +3045,14 @@ addPhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<void&g
| assets | Array
<
[FileAsset](#fileasset)
>
| 是 | 待添加到相册中的图片或视频数组。 |
| callback | AsyncCallback
<
void
>
| 是 | callback返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -2855,6 +3105,14 @@ addPhotoAssets(assets: Array<FileAsset>): Promise<void>;
| --------------------------------------- | ----------------- |
|Promise
<
void
>
| Promise对象,返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -2900,6 +3158,14 @@ removePhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<voi
| assets | Array
<
[FileAsset](#fileasset)
>
| 是 | 相册中待移除的图片或视频数组。 |
| callback | AsyncCallback
<
void
>
| 是 | callback返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -2952,6 +3218,14 @@ removePhotoAssets(assets: Array<FileAsset>): Promise<void>;
| --------------------------------------- | ----------------- |
|Promise
<
void
>
| Promise对象,返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -2997,6 +3271,14 @@ recoverPhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<vo
| assets | Array
<
[FileAsset](#fileasset)
>
| 是 | 回收站中待恢复图片或者视频数组。 |
| callback | AsyncCallback
<
void
>
| 是 | callback返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -3049,6 +3331,14 @@ recoverPhotoAssets(assets: Array<FileAsset>): Promise<void>;
| --------------------------------------- | ----------------- |
|Promise
<
void
>
| Promise对象,返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -3096,6 +3386,14 @@ deletePhotoAssets(assets: Array<FileAsset>, callback: AsyncCallback<voi
| assets | Array
<
[FileAsset](#fileasset)
>
| 是 | 回收站中待彻底删除图片或者视频数组。 |
| callback | AsyncCallback
<
void
>
| 是 | callback返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -3150,6 +3448,14 @@ deletePhotoAssets(assets: Array<FileAsset>): Promise<void>;
| --------------------------------------- | ----------------- |
|Promise
<
void
>
| Promise对象,返回void。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if PhotoAssets is invalid. |
**示例:**
```
ts
...
...
@@ -3211,6 +3517,14 @@ getPhotoAssets(options: FetchOptions, callback: AsyncCallback<FetchResult<
| options |
[
FetchOptions
](
#fetchoptions
)
| 是 | 检索选项。 |
| callback | AsyncCallback
<
[FetchResult](#fetchresult)
<
[FileAsset](#fileasset)
>>
| 是 | callback返回图片和视频数据结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
@@ -3259,6 +3573,14 @@ getPhotoAssets(options: FetchOptions): Promise<FetchResult<FileAsset>&g
| --------------------------------------- | ----------------- |
| Promise:
[
FetchResult
](
#fetchresult
)
<
[FileAsset](#fileasset)
>
| Promise对象,返回图片和视频数据结果集。 |
**错误码:**
接口抛出错误码的详细介绍请参见
[
文件管理错误码
](
../errorcodes/errorcode-filemanagement.md
)
。
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 13900020 | if type options is not FetchOptions. |
**示例:**
```
ts
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录