提交 73eab8cf 编写于 作者: Z zhangxingxia

update apis

Signed-off-by: Nzhangxingxia <zhangxingxia1@huawei.com>
上级 1fbbc31a
......@@ -29,9 +29,9 @@ getStorageDataDir():Promise&lt;string&gt;
```js
environment.getStorageDataDir().then(function(path){
// do something
console.info("getStorageDataDir successfully:"+ path);
}).catch(function(error){
console.info("getStorageDataDir failed with error:"+ error);
});
```
......@@ -71,9 +71,9 @@ getUserDataDir():Promise&lt;string&gt;
```js
environment.getUserDataDir().then(function(path){
// do something
console.info("getUserDataDir successfully:"+ path);
}).catch(function(error){
console.info("getUserDataDir failed with error:"+ error);
});
```
......
......@@ -4,7 +4,7 @@
## 导入模块
```js
import filemanager from 'ohos.filemanager'
import filemanager from 'ohos.filemanager';
```
## 系统能力
......@@ -31,17 +31,15 @@ getRoot(options? : {dev? : DevInfo}) : Promise&lt;FileInfo[]&gt;
- 示例
```js
filemanager.getRoot()
.then((fileInfo) => {
filemanager.getRoot().then((fileInfo) => {
if(Array.isArray(fileInfo)) {
for (var i = 0; i < fileInfo.length; i++) {
console.log(JSON.Stringify(fileInfo))
}
}
})
.catch((err) => {
}).catch((err) => {
console.log(err)
})
});
```
## filemanager.getRoot
......
......@@ -6,7 +6,7 @@
## 导入模块
```js
import statfs from '@ohos.statfs'
import statfs from '@ohos.statfs';
```
## 使用说明
......@@ -18,7 +18,7 @@ import statfs from '@ohos.statfs'
通过上述接口获取到应用目录路径dir,文件名为“xxx.txt”,文件所在绝对路径为:
```js
let path = dir + "xxx.txt"
let path = dir + "xxx.txt";
```
## 系统能力
......@@ -46,7 +46,12 @@ getFreeBytes(path:string):Promise&lt;number&gt;
- 示例:
```js
let num = await statfs.getFreeBytes(path);
let path = "/data";
statfs.getFreeBytes(path).then(function (number){
console.info("getFreeBytes successfully:"+ number);
}).catch(function(err){
console.info("getFreeBytes failed with error:"+ err);
});
```
## statfs.getFreeBytes
......@@ -91,7 +96,12 @@ getTotalBytes.(path:string):Promise&lt;number&gt;
- 示例:
```js
let num = await statfs.getTotalBytes(path);
let path = "/data";
statfs.getTotalBytes(path).then(function (number){
console.info("getTotalBytes successfully:"+ number);
}).catch(function(err){
console.info("getTotalBytes failed with error:"+ err);
});
```
## statfs.getTotalBytes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册