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.
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/>
>
...
...
@@ -35,12 +35,10 @@ Obtains information about the root album or directory in asynchronous mode. This
**Example**
```js
filemanager.getRoot().then((fileInfo)=>{
if(Array.isArray(fileInfo)){
for(vari=0;i<fileInfo.length;i++){
console.log("file:"+JSON.stringify(fileInfo));
}
}
filemanager.getRoot().then((fileInfos)=>{
for(vari=0;i<fileInfos.length;i++){
console.log("files:"+JSON.stringify(fileInfos));
}
}).catch((err)=>{
console.log(err)
});
...
...
@@ -69,14 +67,11 @@ Obtains information about the root album or directory in asynchronous mode. This
"name":"local"
}
};
filemanager.getRoot(options,(err,fileInfo)=>{
if(Array.isArray(fileInfo)){
for(vari=0;i<fileInfo.length;i++){
console.log("file:"+JSON.stringify(fileInfo));
}
}
filemanager.getRoot(options,(err,fileInfos)=>{
for(vari=0;i<fileInfos.length;i++){
console.log("files:"+JSON.stringify(fileInfos));
}
});
```
## filemanager.listFile
...
...
@@ -111,18 +106,17 @@ Obtains information about the second-level album or files in asynchronous mode.
**Example**
```js
// Obtain all files in the directory.
// Call listFile() and getRoot() to obtain the file URI.
letmedia_path=""
filemanager.listFile(media_path,"file")
.then((fileInfo)=>{
if(Array.isArray(fileInfo)){
for(vari=0;i<fileInfo.length;i++){
console.log("file:"+JSON.stringify(fileInfo));
}
}
// Obtain all files in the directory. You can use getRoot to obtain the directory URI.
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.
The **secuityLabel** module provides APIs to manage file data security levels, including obtaining and setting file data security levels.
## Modules to Import
```js
...
...
@@ -48,8 +48,7 @@ Sets the security label for a file in asynchronous mode. This API uses a promise