提交 67978f7a 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 19d0e8d3
# @ohos.filemanagement.userFileManager # @ohos.filemanagement.userFileManager (User Data Management)
The **userFileManager** module provides user data management capabilities, including accessing and modifying user media data (audio and video clips, images, and files). The **userFileManager** module provides user data management capabilities, including accessing and modifying user media data (audio and video clips, images, and files).
...@@ -38,6 +38,7 @@ Obtains a **UserFileManager** instance. This instance can be used to access and ...@@ -38,6 +38,7 @@ Obtains a **UserFileManager** instance. This instance can be used to access and
**Example** **Example**
```ts ```ts
// The userFileManager instance obtained is a global object. It is used by default in subsequent operations. If the code snippet is not added, an error will be reported indicating that mgr is not defined.
const context = getContext(this); const context = getContext(this);
let mgr = userFileManager.getUserFileMgr(context); let mgr = userFileManager.getUserFileMgr(context);
``` ```
...@@ -127,7 +128,7 @@ async function example() { ...@@ -127,7 +128,7 @@ async function example() {
predicates: predicates predicates: predicates
}; };
try { try {
var fetchResult = await mgr.getPhotoAssets(fetchOptions); let fetchResult = await mgr.getPhotoAssets(fetchOptions);
if (fetchResult != undefined) { if (fetchResult != undefined) {
console.info('fetchResult success'); console.info('fetchResult success');
let fileAsset = await fetchResult.getFirstObject(); let fileAsset = await fetchResult.getFirstObject();
...@@ -410,7 +411,7 @@ Obtains the system album. This API uses a promise to return the result. ...@@ -410,7 +411,7 @@ Obtains the system album. This API uses a promise to return the result.
async function example() { async function example() {
console.info('getPrivateAlbumDemo'); console.info('getPrivateAlbumDemo');
try { try {
var fetchResult = await mgr.getPrivateAlbum(userFileManager.PrivateAlbumType.TYPE_TRASH); let fetchResult = await mgr.getPrivateAlbum(userFileManager.PrivateAlbumType.TYPE_TRASH);
let trashAlbum = await fetchResult.getFirstObject(); let trashAlbum = await fetchResult.getFirstObject();
console.info('first album.albumName = ' + trashAlbum.albumName); console.info('first album.albumName = ' + trashAlbum.albumName);
} catch (err) { } catch (err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册