Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f398ffcb
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看板
未验证
提交
f398ffcb
编写于
6月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6119 文档修改
Merge pull request !6119 from wangbo/master
上级
4465246f
50139dd8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
260 addition
and
150 deletion
+260
-150
zh-cn/application-dev/reference/apis/js-apis-document.md
zh-cn/application-dev/reference/apis/js-apis-document.md
+7
-7
zh-cn/application-dev/reference/apis/js-apis-fileio.md
zh-cn/application-dev/reference/apis/js-apis-fileio.md
+201
-92
zh-cn/application-dev/reference/apis/js-apis-filemanager.md
zh-cn/application-dev/reference/apis/js-apis-filemanager.md
+8
-8
zh-cn/application-dev/reference/apis/js-apis-securityLabel.md
...n/application-dev/reference/apis/js-apis-securityLabel.md
+26
-26
zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md
...lication-dev/reference/apis/js-apis-storage-statistics.md
+18
-17
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-document.md
浏览文件 @
f398ffcb
...
...
@@ -16,7 +16,7 @@ choose(types:string[]): Promise<string>
通过文件管理器选择文件,异步返回文件URI,使用promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
File.FileIO
**系统能力**
:SystemCapability.FileManagement.
UserFileService
-
参数:
...
...
@@ -42,7 +42,7 @@ choose(callback:AsyncCallback<string>): void
通过文件管理器选择文件,异步返回文件URI,使用callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
File.FileIO
**系统能力**
:SystemCapability.FileManagement.
UserFileService
-
参数:
...
...
@@ -64,7 +64,7 @@ choose(types:string[], callback:AsyncCallback<string>): void
通过文件管理器选择文件,异步返回文件URI,使用callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
File.FileIO
**系统能力**
:SystemCapability.FileManagement.
UserFileService
-
参数:
...
...
@@ -85,11 +85,11 @@ choose(types:string[], callback:AsyncCallback<string>): void
## document.show
show(ur
l:string, types:string):Promise
<
number
>
show(ur
i:string, types:string):Promise
<
void
>
异步打开URI对应的文件,使用promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
File.FileIO
**系统能力**
:SystemCapability.FileManagement.
UserFileService
-
参数:
...
...
@@ -114,11 +114,11 @@ show(url:string, types:string):Promise<number>
## document.show
show(ur
l
:string, types:string, callback:AsyncCallback
<
void
>
): void
show(ur
i
:string, types:string, callback:AsyncCallback
<
void
>
): void
异步打开URI对应的文件,使用callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
File.FileIO
**系统能力**
:SystemCapability.FileManagement.
UserFileService
-
参数:
...
...
zh-cn/application-dev/reference/apis/js-apis-fileio.md
浏览文件 @
f398ffcb
...
...
@@ -18,7 +18,10 @@ import fileio from '@ohos.fileio';
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
path
=
context
.
getFilesDir
();
let
path
=
''
;
context
.
getFilesDir
().
then
((
data
)
=>
{
path
=
data
;
})
```
...
...
@@ -324,11 +327,52 @@ closeSync(fd: number): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
fileio
.
closeSync
(
fd
);
```
## fileio.close<sup>7+</sup>
close(): Promise
<
void
>
关闭文件流,使用Promise异步回调。
**系统能力**
:SystemCapability.FileManagement.File.FileIO
**返回值:**
| 类型 | 说明 |
| ------------------- | ---------------------------- |
| Promise
<
void
>
| Promise对象。无返回值。 |
**示例:**
```
js
fileio
.
close
().
then
(
function
(){
console
.
info
(
"
close file stream succeed
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
close file stream failed with error:
"
+
err
);
});
```
## fileio.close<sup>7+</sup>
close(callback: AsyncCallback
<
void
>
): void
关闭文件流,使用callback异步回调。
**系统能力**
:SystemCapability.FileManagement.File.FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------- |
| callback | AsyncCallback
<
void
>
| 是 | 异步关闭文件流之后的回调。 |
**示例:**
```
js
fileio
.
close
(
function
(
err
){
// do something
});
```
## fileio.copyFile
...
...
@@ -353,8 +397,7 @@ copyFile(src:string | number, dest:string | number, mode?:number):Promise<voi
**示例:**
```
js
let
dest
=
""
;
fileio
.
copyFile
(
path
,
dest
).
then
(
function
(){
fileio
.
copyFile
(
src
,
dest
).
then
(
function
(){
console
.
info
(
"
copyFile succeed
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
copyFile failed with error:
"
+
err
);
...
...
@@ -380,8 +423,7 @@ copyFile(src: string | number, dest: string | number, mode: number, callback: As
**示例:**
```
js
let
dest
=
""
;
fileio
.
copyFile
(
path
,
dest
,
function
(
err
)
{
fileio
.
copyFile
(
src
,
dest
,
function
(
err
)
{
// do something
});
```
...
...
@@ -404,8 +446,7 @@ copyFileSync(src: string | number, dest: string | number, mode?: number): void
**示例:**
```
js
let
dest
=
""
;
fileio
.
copyFileSync
(
path
,
dest
);
fileio
.
copyFileSync
(
src
,
dest
);
```
...
...
@@ -548,7 +589,7 @@ openSync(path:string, flags?:number, mode?:number): number
| ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | 是 | 待打开文件的应用沙箱路径。 |
| flags | number | 否 | 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开:
<br/>
-
0o0:只读打开。
<br/>
-
0o1:只写打开。
<br/>
-
0o2:读写打开。
<br/>
同时,也可给定如下选项,以按位或的方式追加,默认不给定任何额外选项:
<br/>
-
0o100:若文件不存在,则创建文件。使用该选项时必须指定第三个参数
mode。
<br/>
-
0o200:如果追加了0o100选项,且文件已经存在,则出错。
<br/>
-
0o1000:如果文件存在且以只写或读写的方式打开文件,则将其长度裁剪为零。
<br/>
-
0o2000:以追加方式打开,后续写将追加到文件末尾。
<br/>
-
0o4000:如果path指向FIFO、块特殊文件或字符特殊文件,则本次打开及后续
IO
进行非阻塞操作。
<br/>
-
0o200000:如果path不指向目录,则出错。
<br/>
-
0o400000:如果path指向符号链接,则出错。
<br/>
-
0o4010000:以同步IO的方式打开文件。 |
| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o666。
<br/>
-
0o666:所有者具有读、写权限,所有用户组具有读、写权限,其余用户具有读、写权限。
<br/>
-
0o700:所有者具有读、写及可执行权限。
<br/>
-
0o400:所有者具有读权限。
<br/>
-
0o200:所有者具有写权限。
<br/>
-
0o100:所有者具有可执行权限。
<br/>
-
0o070:所有用户组具有读、写及可执行权限。
<br/>
-
0o040:所有用户组具有读权限。
<br/>
-
0o020:所有用户组具有写权限。
<br/>
-
0o010:所有用户组具有可执行权限。
<br/>
-
0o007:其余用户具有读、写及可执行权限。
<br/>
-
0o004:其余用户具有读权限。
<br/>
-
0o002:其余用户具有写权限。
<br/>
-
0o001:其余用户具有可执行权限。
<br/>
创建出的文件权限受umask影响,umask随进程启动确定,其修改当前不开放。 |
| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o666。
<br/>
-
0o666:所有者具有读、写权限,所有用户组具有读、写权限,其余用户具有读、写权限。
<br/>
-
0o
640:所有者具有读、写权限,所有用户组具有读权限。
<br/>
-
0o
700:所有者具有读、写及可执行权限。
<br/>
-
0o400:所有者具有读权限。
<br/>
-
0o200:所有者具有写权限。
<br/>
-
0o100:所有者具有可执行权限。
<br/>
-
0o070:所有用户组具有读、写及可执行权限。
<br/>
-
0o040:所有用户组具有读权限。
<br/>
-
0o020:所有用户组具有写权限。
<br/>
-
0o010:所有用户组具有可执行权限。
<br/>
-
0o007:其余用户具有读、写及可执行权限。
<br/>
-
0o004:其余用户具有读权限。
<br/>
-
0o002:其余用户具有写权限。
<br/>
-
0o001:其余用户具有可执行权限。
<br/>
创建出的文件权限受umask影响,umask随进程启动确定,其修改当前不开放。 |
**返回值:**
| 类型 | 说明 |
...
...
@@ -557,7 +598,15 @@ openSync(path:string, flags?:number, mode?:number): number
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
fd
=
fileio
.
openSync
(
path
,
0o102
,
0o640
);
```
```
js
let
fd
=
fileio
.
openSync
(
path
,
0o102
,
0o666
);
fileio
.
writeSync
(
fd
,
'
hello world
'
);
let
fd1
=
fileio
.
openSync
(
path
,
0o2002
);
fileio
.
writeSync
(
fd1
,
'
hello world
'
);
let
num
=
fileio
.
readSync
(
fd1
,
new
ArrayBuffer
(
4096
),
{
position
:
0
});
console
.
info
(
"
num ==
"
+
num
);
```
...
...
@@ -830,7 +879,7 @@ write(fd: number, buffer: ArrayBuffer | string, options?: {
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
,
0o100
|
0o2
,
0o666
);
let
fd
=
fileio
.
openSync
(
f
path
,
0o100
|
0o2
,
0o666
);
fileio
.
write
(
fd
,
"
hello, world
"
).
then
(
function
(
number
){
console
.
info
(
"
write data to file succeed and size is:
"
+
number
);
}).
catch
(
function
(
err
){
...
...
@@ -927,7 +976,7 @@ hash(path: string, algorithm: string): Promise<string>
fileio
.
hash
(
path
,
"
sha256
"
).
then
(
function
(
str
){
console
.
info
(
"
calculate file hash succeed:
"
+
str
);
}).
catch
(
function
(
error
){
console
.
info
(
"
calculate file hash failed with error:
"
+
err
or
);
console
.
info
(
"
calculate file hash failed with error:
"
+
err
);
});
```
...
...
@@ -949,7 +998,7 @@ hash(path: string, algorithm: string, callback: AsyncCallback<string>): vo
**示例:**
```
js
fileio
.
hash
(
path
,
"
sha256
"
,
function
(
err
,
hashStr
)
{
fileio
.
hash
(
f
path
,
"
sha256
"
,
function
(
err
,
hashStr
)
{
if
(
hashStr
)
{
console
.
info
(
"
calculate file hash succeed:
"
+
hashStr
);
}
...
...
@@ -978,7 +1027,7 @@ chmod(path: string, mode: number):Promise<void>
**示例:**
```
js
fileio
.
chmod
(
path
,
0o400
).
then
(
function
()
{
fileio
.
chmod
(
path
,
mode
).
then
(
function
()
{
console
.
info
(
"
chmod succeed
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
chmod failed with error:
"
+
err
);
...
...
@@ -1003,7 +1052,7 @@ chmod(path: string, mode: number, callback: AsyncCallback<void>): void
**示例:**
```
js
fileio
.
chmod
(
path
,
0o400
,
function
(
err
)
{
fileio
.
chmod
(
path
,
mode
,
function
(
err
)
{
// do something
});
```
...
...
@@ -1025,7 +1074,7 @@ chmodSync(path: string, mode: number): void
**示例:**
```
js
fileio
.
chmodSync
(
path
,
0o400
);
fileio
.
chmodSync
(
fpath
,
mode
);
```
...
...
@@ -1049,7 +1098,6 @@ fstat(fd: number): Promise<Stat>
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
fileio
.
fstat
(
fd
).
then
(
function
(
stat
){
console
.
info
(
"
fstat succeed:
"
+
JSON
.
stringify
(
stat
));
}).
catch
(
function
(
err
){
...
...
@@ -1153,8 +1201,6 @@ ftruncate(fd: number, len: number, callback:AsyncCallback<void>): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
len
=
5
;
fileio
.
ftruncate
(
fd
,
len
,
function
(
err
){
// do something
});
...
...
@@ -1177,8 +1223,6 @@ ftruncateSync(fd: number, len?: number): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
len
=
5
;
fileio
.
ftruncateSync
(
fd
,
len
);
```
...
...
@@ -1204,7 +1248,6 @@ truncate(path: string, len?: number): Promise<void>
**示例:**
```
js
let
len
=
5
;
fileio
.
truncate
(
path
,
len
).
then
(
function
(){
console
.
info
(
"
truncate file succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -1230,7 +1273,6 @@ truncate(path: string, len: number, callback:AsyncCallback<void>): void
**示例:**
```
js
let
len
=
5
;
fileio
.
truncate
(
path
,
len
,
function
(
err
){
// do something
});
...
...
@@ -1253,7 +1295,6 @@ truncateSync(path: string, len?: number): void
**示例:**
```
js
let
len
=
5
;
fileio
.
truncateSync
(
path
,
len
);
```
...
...
@@ -1312,7 +1353,7 @@ readText(filePath: string, options: {
**示例:**
```
js
fileio
.
readText
(
path
,
{
position
:
pos
,
length
:
len
,
encoding
:
'
UTF-8
'
},
function
(
err
,
str
){
fileio
.
readText
(
path
,
function
(
err
,
str
){
// do something
});
```
...
...
@@ -1368,7 +1409,7 @@ lstat(path: string): Promise<Stat>
**示例:**
```
js
fileio
.
lstat
(
path
).
then
(
function
(
stat
){
console
.
info
(
"
get link status succeed:
"
+
stat
.
rdev
);
console
.
info
(
"
get link status succeed:
"
+
number
);
}).
catch
(
function
(
err
){
console
.
info
(
"
get link status failed with error:
"
+
err
);
});
...
...
@@ -1421,6 +1462,69 @@ lstatSync(path:string): Stat
```
## fileio.read<sup>7+</sup>
read(buffer: ArrayBuffer, options?: {
position?: number;
offset?: number;
length?: number;
}): Promise
<
ReadOut
>
从文件读取数据,使用Promise异步回调。
**系统能力**
:SystemCapability.FileManagement.File.FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ----------- | ---- | ------------------------------------------------------------ |
| buffer | ArrayBuffer | 是 | 用于保存读取到的文件数据的缓冲区。 |
| options | Object | 否 | 支持如下选项:
<br/>
-
offset,number类型,表示将数据读取到缓冲区的位置,即相对于缓冲区首地址的偏移。可选,默认为0。
<br/>
-
length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。
<br/>
约束:offset+length<=buffer.size。 |
**返回值:**
| 类型 | 说明 |
| ---------------------------------- | ------ |
| Promise
<
[ReadOut](#readout)
>
| Promise对象。返回读取的结果。 |
**示例:**
```
js
fileio
.
read
(
new
ArrayBuffer
(
4096
)).
then
(
function
(
readout
){
console
.
info
(
"
read file data succeed
"
);
console
.
log
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
readOut
.
buffer
)));
}).
catch
(
function
(
err
){
console
.
info
(
"
read file data failed with error:
"
+
err
);
});
```
## fileio.read<sup>7+</sup>
read(buffer: ArrayBuffer, options: {
position?: number;
offset?: number;
length?: number;
}, callback: AsyncCallback
<
ReadOut
>
): void
从文件读取数据,使用callback异步回调。
**系统能力**
:SystemCapability.FileManagement.File.FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| buffer | ArrayBuffer | 是 | 用于保存读取到的文件数据的缓冲区。 |
| options | Object | 否 | 支持如下选项:
<br/>
-
offset,number类型,表示将数据读取到缓冲区的位置,即相对于缓冲区首地址的偏移。可选,默认为0。
<br/>
-
length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。
<br/>
约束:offset+length<=buffer.size。 |
| callback | AsyncCallback
<
[ReadOut](#readout)
>
| 是 | 异步从文件读取数据之后的回调。 |
**示例:**
```
js
let
buf
=
new
ArrayBuffer
(
4096
);
fileio
.
read
(
buf
,
function
(
err
,
readOut
)
{
if
(
readOut
)
{
console
.
info
(
"
read file data succeed
"
);
console
.
log
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
readOut
.
buffer
)));
}
});
```
## fileio.rename<sup>7+</sup>
...
...
@@ -1444,8 +1548,7 @@ rename(oldPath: string, newPath: string): Promise<void>
**示例:**
```
js
let
newPath
=
path
+
"
123
"
;
fileio
.
rename
(
path
,
newPath
).
then
(
function
()
{
fileio
.
rename
(
oldPath
,
newPath
).
then
(
function
()
{
console
.
info
(
"
rename succeed
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
rename failed with error:
"
+
err
);
...
...
@@ -1470,8 +1573,7 @@ rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): v
**示例:**
```
js
let
newPath
=
path
+
"
123
"
;
fileio
.
rename
(
path
,
newPath
,
function
(
err
){
fileio
.
rename
(
oldPath
,
newPath
,
function
(
err
){
});
```
...
...
@@ -1492,8 +1594,7 @@ renameSync(oldPath: string, newPath: string): void
**示例:**
```
js
let
newPath
=
path
+
"
123
"
;
fileio
.
renameSync
(
path
,
newPath
);
fileio
.
renameSync
(
oldPath
,
newPath
);
```
...
...
@@ -1517,7 +1618,6 @@ fsync(fd: number): Promise<void>
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
fileio
.
fsync
(
fd
).
then
(
function
(){
console
.
info
(
"
sync data succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -1541,8 +1641,7 @@ fsync(fd: number, callback: AsyncCallback<void>): void
| Callback | AsyncCallback
<
void
>
| 是 | 异步将文件数据同步之后的回调。 |
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
```
js
fileio
.
fsync
(
fd
,
function
(
err
){
// do something
});
...
...
@@ -1564,7 +1663,6 @@ fsyncSync(fd: number): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
fileio
.
fyncsSync
(
fd
);
```
...
...
@@ -1588,8 +1686,7 @@ fdatasync(fd: number): Promise<void>
| Promise
<
void
>
| Promise对象。无返回值。 |
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
```
js
fileio
.
fdatasync
(
fd
).
then
(
function
(
err
)
{
console
.
info
(
"
sync data succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -1614,7 +1711,6 @@ fdatasync(fd: number, callback:AsyncCallback<void>): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
fileio
.
fdatasync
(
fd
,
function
(
err
)
{
// do something
});
...
...
@@ -1636,7 +1732,6 @@ fdatasyncSync(fd: number): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
stat
=
fileio
.
fdatasyncSync
(
fd
);
```
...
...
@@ -1662,8 +1757,7 @@ symlink(target: string, srcPath: string): Promise<void>
**示例:**
```
js
let
srcPath
=
""
;
fileio
.
symlink
(
path
,
srcPath
).
then
(
function
()
{
fileio
.
symlink
(
target
,
srcPath
).
then
(
function
()
{
console
.
info
(
"
symlink succeed
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
symlink failed with error:
"
+
err
);
...
...
@@ -1688,8 +1782,7 @@ symlink(target: string, srcPath: string, callback: AsyncCallback<void>): v
**示例:**
```
js
let
srcPath
=
""
;
fileio
.
symlink
(
path
,
srcPath
,
function
(
err
)
{
fileio
.
symlink
(
target
,
srcPath
,
function
(
err
)
{
// do something
});
```
...
...
@@ -1711,8 +1804,7 @@ symlinkSync(target: string, srcPath: string): void
**示例:**
```
js
let
srcPath
=
""
;
fileio
.
symlinkSync
(
path
,
srcPath
);
fileio
.
symlinkSync
(
target
,
srcPath
);
```
...
...
@@ -1765,7 +1857,7 @@ chown(path: string, uid: number, gid: number, callback: AsyncCallback<void>
**示例:**
```
js
let
stat
=
fileio
.
statSync
(
path
)
let
stat
=
fileio
.
statSync
(
f
path
)
fileio
.
chown
(
path
,
stat
.
uid
,
stat
.
gid
,
function
(
err
){
// do something
});
...
...
@@ -1789,7 +1881,7 @@ chownSync(path: string, uid: number, gid: number): void
**示例:**
```
js
let
stat
=
fileio
.
statSync
(
path
)
let
stat
=
fileio
.
statSync
(
f
path
)
fileio
.
chownSync
(
path
,
stat
.
uid
,
stat
.
gid
);
```
...
...
@@ -1889,8 +1981,6 @@ fchmod(fd: number, mode: number): Promise<void>
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
mode
=
0o400
;
fileio
.
fchmod
(
fd
,
mode
).
then
(
function
()
{
console
.
info
(
"
chmod succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -1916,8 +2006,6 @@ fchmod(fd: number, mode: number, callback: AsyncCallback<void>): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
mode
=
0o400
;
fileio
.
fchmod
(
fd
,
mode
,
function
(
err
)
{
// do something
});
...
...
@@ -1940,9 +2028,7 @@ fchmodSync(fd: number, mode: number): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
mode
=
0o400
;
fileio
.
fchmodSync
(
fd
,
mode
);
fileio
.
fchmodSync
(
fd
,
mode
);
```
...
...
@@ -1992,7 +2078,6 @@ createStream(path: string, mode: string, callback: AsyncCallback<Stream>):
**示例:**
```
js
let
mode
=
0o400
;
fileio
.
createStream
(
path
,
mode
,
function
(
err
,
stream
){
// do something
});
...
...
@@ -2045,8 +2130,6 @@ fdopenStream(fd: number, mode: string): Promise<Stream>
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
mode
=
0o400
;
fileio
.
fdopenStream
(
fd
,
mode
).
then
(
function
(
stream
){
console
.
info
(
"
openStream succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -2072,8 +2155,6 @@ fdopenStream(fd: number, mode: string, callback: AsyncCallback<Stream>): v
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
mode
=
0o400
;
fileio
.
fdopenStream
(
fd
,
mode
,
function
(
err
,
stream
)
{
// do something
});
...
...
@@ -2101,7 +2182,6 @@ fdopenStreamSync(fd: number, mode: string): Stream
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
ss
=
fileio
.
fdopenStreamSync
(
fd
,
"
r+
"
);
```
...
...
@@ -2128,7 +2208,6 @@ fchown(fd: number, uid: number, gid: number): Promise<void>
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
stat
=
fileio
.
statSync
(
path
);
fileio
.
fchown
(
fd
,
stat
.
uid
,
stat
.
gid
).
then
(
function
()
{
console
.
info
(
"
chown succeed
"
);
...
...
@@ -2156,8 +2235,7 @@ fchown(fd: number, uid: number, gid: number, callback: AsyncCallback<void>
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
stat
=
fileio
.
statSync
(
path
);
let
stat
=
fileio
.
statSync
(
fpath
);
fileio
.
fchown
(
fd
,
stat
.
uid
,
stat
.
gid
,
function
(
err
){
// do something
});
...
...
@@ -2181,8 +2259,7 @@ fchownSync(fd: number, uid: number, gid: number): void
**示例:**
```
js
let
fd
=
fileio
.
openSync
(
path
);
let
stat
=
fileio
.
statSync
(
path
);
let
stat
=
fileio
.
statSync
(
fpath
);
fileio
.
fchownSync
(
fd
,
stat
.
uid
,
stat
.
gid
);
```
...
...
@@ -2287,8 +2364,6 @@ createWatcher(filename: string, events: number, callback: AsyncCallback<numbe
**示例:**
```
js
let
filename
=
path
+
"
/test.txt
"
;
let
events
=
1
;
fileio
.
createWatcher
(
filename
,
events
,
function
(
watcher
){
// do something
});
...
...
@@ -2423,7 +2498,7 @@ isFile(): boolean
**示例:**
```
js
let
isFile
=
fileio
.
statSync
(
path
).
isFile
();
let
isFile
=
fileio
.
statSync
(
f
path
).
isFile
();
```
...
...
@@ -2525,7 +2600,7 @@ close(): Promise<void>
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
path
);
ss
.
close
().
then
(
function
(){
console
.
info
(
"
close fileStream succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -2566,7 +2641,7 @@ closeSync(): void
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
path
);
ss
.
closeSync
();
```
...
...
@@ -2586,7 +2661,7 @@ flush(): Promise<void>
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
path
);
ss
.
flush
().
then
(
function
(){
console
.
info
(
"
flush succeed
"
);
}).
catch
(
function
(
err
){
...
...
@@ -2610,7 +2685,7 @@ flush(callback: AsyncCallback<void>): void
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
path
);
ss
.
flush
(
function
(
err
)
{
// do something
});
...
...
@@ -2627,7 +2702,7 @@ flushSync(): void
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
path
);
ss
.
flushSync
();
```
...
...
@@ -2658,7 +2733,7 @@ write(buffer: ArrayBuffer | string, options?: {
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
f
path
,
"
r+
"
);
ss
.
write
(
"
hello, world
"
,{
offset
:
1
,
length
:
5
,
position
:
5
,
encoding
:
'
utf-8
'
}).
then
(
function
(
number
){
console
.
info
(
"
write succeed and size is:
"
+
number
);
}).
catch
(
function
(
err
){
...
...
@@ -2689,7 +2764,7 @@ write(buffer: ArrayBuffer | string, options: {
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
f
path
,
"
r+
"
);
ss
.
write
(
"
hello, world
"
,
{
offset
:
1
,
length
:
5
,
position
:
5
,
encoding
:
'
utf-8
'
},
function
(
err
,
bytesWritten
)
{
if
(
bytesWritten
)
{
// do something
...
...
@@ -2725,7 +2800,7 @@ writeSync(buffer: ArrayBuffer | string, options?: {
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
f
path
,
"
r+
"
);
let
num
=
ss
.
writeSync
(
"
hello, world
"
,
{
offset
:
1
,
length
:
5
,
position
:
5
,
encoding
:
'
utf-8
'
});
```
...
...
@@ -2755,10 +2830,10 @@ read(buffer: ArrayBuffer, options?: {
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
f
path
,
"
r+
"
);
ss
.
read
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
length
:
5
,
position
:
5
}).
then
(
function
(
readout
){
console
.
info
(
"
read data succeed
"
);
console
.
log
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
read
o
ut
.
buffer
)));
console
.
log
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
read
O
ut
.
buffer
)));
}).
catch
(
function
(
err
){
console
.
info
(
"
read data failed with error:
"
+
err
);
});
...
...
@@ -2786,7 +2861,7 @@ read(buffer: ArrayBuffer, options: {
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
f
path
,
"
r+
"
);
ss
.
read
(
new
ArrayBuffer
(
4096
),{
offset
:
1
,
length
:
5
,
position
:
5
},
function
(
err
,
readOut
)
{
if
(
readOut
)
{
console
.
info
(
"
read data succeed
"
);
...
...
@@ -2823,7 +2898,7 @@ readSync(buffer: ArrayBuffer, options?: {
**示例:**
```
js
let
ss
=
fileio
.
createStreamSync
(
path
,
"
r+
"
);
let
ss
=
fileio
.
createStreamSync
(
f
path
,
"
r+
"
);
let
num
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
length
:
5
,
position
:
5
});
```
...
...
@@ -2848,7 +2923,7 @@ read(): Promise<Dirent>
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
dir
.
read
().
then
(
function
(
dirent
){
console
.
log
(
"
read succeed:
"
+
JSON
.
stringify
(
dirent
));
}).
catch
(
function
(
err
){
...
...
@@ -2872,7 +2947,7 @@ read(callback: AsyncCallback<Dirent>): void
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
dir
.
read
(
function
(
err
,
dirent
)
{
if
(
dirent
)
{
// do something
...
...
@@ -2897,11 +2972,45 @@ readSync(): Dirent
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
dirent
=
dir
.
readSync
();
```
### close<sup>7+</sup>
close(): Promise
<
void
>
异步关闭目录,使用promise形式返回结果。目录被关闭后,Dir中持有的文件描述将被释放,后续将无法从Dir中读取目录项。
**系统能力**
:SystemCapability.FileManagement.File.FileIO
**示例:**
```
js
let
dir
=
fileio
.
opendirSync
(
path
);
dir
.
close
().
then
(
function
(
err
){
console
.
info
(
"
close dir successfully
"
);
});
```
### close
<sup>
7+
</sup>
close(callback: AsyncCallback
<
void
>
): void
异步关闭目录,使用callback形式返回结果。目录被关闭后,Dir中持有的文件描述将被释放,后续将无法从Dir中读取目录项。
**系统能力**
:SystemCapability.FileManagement.File.FileIO
**示例:**
```
js
let
dir
=
fileio
.
opendirSync
(
path
);
dir
.
close
(
function
(
err
){
console
.
info
(
"
close dir successfully
"
);
});
```
### closeSync
closeSync(): void
...
...
@@ -2912,7 +3021,7 @@ closeSync(): void
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
dir
.
closeSync
();
```
...
...
@@ -2945,7 +3054,7 @@ isBlockDevice(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
isBLockDevice
=
dir
.
readSync
().
isBlockDevice
();
```
...
...
@@ -2965,7 +3074,7 @@ isCharacterDevice(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
isCharacterDevice
=
dir
.
readSync
().
isCharacterDevice
();
```
...
...
@@ -2985,7 +3094,7 @@ isDirectory(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
isDirectory
=
dir
.
readSync
().
isDirectory
();
```
...
...
@@ -3005,7 +3114,7 @@ isFIFO(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
isFIFO
=
dir
.
readSync
().
isFIFO
();
```
...
...
@@ -3025,7 +3134,7 @@ isFile(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
isFile
=
dir
.
readSync
().
isFile
();
```
...
...
@@ -3045,7 +3154,7 @@ isSocket(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
d
path
);
let
isSocket
=
dir
.
readSync
().
isSocket
();
```
...
...
@@ -3065,6 +3174,6 @@ isSymbolicLink(): boolean
**示例:**
```
js
dir
=
fileio
.
opendirSync
(
path
);
let
dir
=
fileio
.
opendirSync
(
path
);
let
isSymbolicLink
=
dir
.
readSync
().
isSymbolicLink
();
```
zh-cn/application-dev/reference/apis/js-apis-filemanager.md
浏览文件 @
f398ffcb
...
...
@@ -18,7 +18,7 @@ getRoot(options? : {dev? : DevInfo}) : Promise<FileInfo[]>
以异步方法获取第一层相册,目录信息。使用promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
FileManager
Service
**系统能力**
:SystemCapability.FileManagement.
UserFile
Service
-
参数
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -51,7 +51,7 @@ getRoot(options? : {dev? : DevInfo}, callback : AsyncCallback<FileInfo[]>)
以异步方法获取第一层相册,目录信息。使用callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
FileManager
Service
**系统能力**
:SystemCapability.FileManagement.
UserFile
Service
-
参数
...
...
@@ -84,7 +84,7 @@ listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : num
以异步方法获取第二层相册,文件信息。使用promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
FileManager
Service
**系统能力**
:SystemCapability.FileManagement.
UserFile
Service
-
参数
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -133,7 +133,7 @@ listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : num
以异步方法获取第二层相册,文件信息。使用callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
FileManager
Service
**系统能力**
:SystemCapability.FileManagement.
UserFile
Service
-
参数
...
...
@@ -187,7 +187,7 @@ createFile(path : string, filename : string, options? : {dev? : DevInfo}) : P
以异步方法创建文件到指定路径,返回文件uri。使用promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
FileManager
Service
**系统能力**
:SystemCapability.FileManagement.
UserFile
Service
-
参数
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -230,7 +230,7 @@ createFile(path : string, filename: string, options? : {dev? : DevInfo}, callbac
以异步方法创建文件到指定路径,返回文件uri。使用callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.
FileManager
Service
**系统能力**
:SystemCapability.FileManagement.
UserFile
Service
-
参数
...
...
@@ -269,7 +269,7 @@ createFile(path : string, filename: string, options? : {dev? : DevInfo}, callbac
## FileInfo
文件信息类型,通过getRoot, listFile等接口返回的类型。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.FileManagement.
FileManager
Service。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.FileManagement.
UserFile
Service。
### 属性
...
...
@@ -286,7 +286,7 @@ createFile(path : string, filename: string, options? : {dev? : DevInfo}, callbac
设备类型,配置接口访问的设备类型。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.FileManagement.
FileManager
Service。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.FileManagement.
UserFile
Service。
### 属性
...
...
zh-cn/application-dev/reference/apis/js-apis-securityLabel.md
浏览文件 @
f398ffcb
...
...
@@ -23,18 +23,18 @@ let path = context.getFilesDir();
## securityLabel.setSecurityLabel
setSecurityLabel(path:string,
dataLevel:string
):Promise
<
void
>
setSecurityLabel(path:string,
type:dataLevel
):Promise
<
void
>
以异步方法设置数据标签,以promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.File.
DistributedFile
**系统能力**
:SystemCapability.FileManagement.File.
FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | -------------------------------------------- |
| path | string | 是 | 文件路径 |
|
dataLevel | string
| 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" |
| 参数名 | 类型
| 必填 | 说明 |
| --------- | ------
| ---- | -------------------------------------------- |
| path | string
| 是 | 文件路径 |
|
type | dataLevel
| 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" |
**返回值:**
...
...
@@ -45,8 +45,8 @@ setSecurityLabel(path:string, dataLevel:string):Promise<void>
**示例:**
```
js
let
dataLevel
=
"
s4
"
;
securityLabel
.
setSecurityLabel
(
path
,
dataLevel
).
then
(
function
(){
let
type
=
"
s4
"
;
securityLabel
.
setSecurityLabel
(
path
,
type
).
then
(
function
(){
console
.
info
(
"
setSecurityLabel successfully
"
);
}).
catch
(
function
(
error
){
console
.
info
(
"
setSecurityLabel failed with error:
"
+
error
);
...
...
@@ -55,25 +55,25 @@ setSecurityLabel(path:string, dataLevel:string):Promise<void>
## securityLabel.setSecurityLabel
setSecurityLabel(path:string,
dataLevel:string
, callback: AsyncCallback
<
void
>
):void
setSecurityLabel(path:string,
type:dataLevel
, callback: AsyncCallback
<
void
>
):void
以异步方法设置数据标签,以callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.File.
DistributedFile
**系统能力**
:SystemCapability.FileManagement.File.
FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | -------------------------------------------- |
| path | string | 是 | 文件路径 |
|
dataLevel | string
| 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" |
|
type | dataLevel
| 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" |
| callback | AsyncCallback
<
void
>
| 是 | 是否设置数据标签之后的回调 |
**示例:**
```
js
let
dataLevel
=
"
s4
"
;
securityLabel
.
setSecurityLabel
(
path
,
dataLevel
,
function
(
error
){
let
type
=
"
s4
"
;
securityLabel
.
setSecurityLabel
(
path
,
type
,
function
(
error
){
console
.
info
(
"
setSecurityLabel:
"
+
JSON
.
stringify
(
error
));
});
```
...
...
@@ -83,20 +83,20 @@ setSecurityLabelSync(path:string, dataLevel:string):void
以同步方法设置数据标签。
**系统能力**
:SystemCapability.FileManagement.File.
DistributedFile
**系统能力**
:SystemCapability.FileManagement.File.
FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | -------------------------------------------- |
| path | string | 是 | 文件路径 |
|
dataLevel | string
| 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" |
|
type | dataLevel
| 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" |
**示例:**
```
js
let
dataLevel
=
"
s4
"
;
securityLabel
.
setSecurityLabelSync
(
path
,
dataLevel
);
let
type
=
"
s4
"
;
securityLabel
.
setSecurityLabelSync
(
path
,
type
);
```
## securityLabel.getSecurityLabel
...
...
@@ -105,7 +105,7 @@ getSecurityLabel(path:string):Promise<string>
异步方法获取数据标签,以promise形式返回结果。
**系统能力**
:SystemCapability.FileManagement.File.
DistributedFile
**系统能力**
:SystemCapability.FileManagement.File.
FileIO
**参数:**
...
...
@@ -122,9 +122,9 @@ getSecurityLabel(path:string):Promise<string>
**示例:**
```
js
let
dataLevel
=
"
s4
"
;
securityLabel
.
getSecurityLabel
(
path
).
then
(
function
(
dataLevel
){
console
.
log
(
"
getSecurityLabel successfully:
"
+
dataLevel
);
let
type
=
"
s4
"
;
securityLabel
.
getSecurityLabel
(
path
).
then
(
function
(
type
){
console
.
log
(
"
getSecurityLabel successfully:
"
+
type
);
}).
catch
(
function
(
error
){
console
.
log
(
"
getSecurityLabel failed with error:
"
+
error
);
});
...
...
@@ -136,7 +136,7 @@ getSecurityLabel(path:string, callback:AsyncCallback<string>): void
异步方法获取数据标签,以callback形式返回结果。
**系统能力**
:SystemCapability.FileManagement.File.
DistributedFile
**系统能力**
:SystemCapability.FileManagement.File.
FileIO
**参数:**
...
...
@@ -148,9 +148,9 @@ getSecurityLabel(path:string, callback:AsyncCallback<string>): void
**示例:**
```
js
let
dataLevel
=
"
s4
"
;
securityLabel
.
getSecurityLabel
(
path
,
function
(
error
,
dataLevel
){
console
.
log
(
"
getSecurityLabel successfully:
"
+
dataLevel
);
let
type
=
"
s4
"
;
securityLabel
.
getSecurityLabel
(
path
,
function
(
error
,
type
){
console
.
log
(
"
getSecurityLabel successfully:
"
+
type
);
});
```
## securityLabel.getSecurityLabelSync
...
...
@@ -159,7 +159,7 @@ getSecurityLabelSync(path:string):string
以同步方法获取数据标签。
**系统能力**
:SystemCapability.FileManagement.File.
DistributedFile
**系统能力**
:SystemCapability.FileManagement.File.
FileIO
**参数:**
...
...
zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md
浏览文件 @
f398ffcb
...
...
@@ -23,7 +23,7 @@ getTotalSizeOfVolume(volumeUuid: string): Promise<number>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -58,7 +58,7 @@ getTotalSizeOfVolume(volumeUuid: string, callback:AsyncCallback<number>):v
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -89,7 +89,7 @@ getFreeSizeOfVolume(volumeUuid: string): Promise<number>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -125,7 +125,7 @@ getFreeSizeOfVolume(volumeUuid: string, callback:AsyncCallback<number>):vo
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -154,7 +154,7 @@ getBundleStats(packageName: string): Promise<BundleStats>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -189,7 +189,7 @@ getBundleStats(packageName: string, callback: AsyncCallback<BundleStats>)
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -259,6 +259,7 @@ getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void
## BundleStats<sup>9+</sup>
**系统能力**
:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics。
该接口为系统接口,三方应用不支持调用
-
属性
...
...
@@ -281,7 +282,7 @@ getTotalSize(): Promise<number>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
返回值
...
...
@@ -306,7 +307,7 @@ getTotalSize(callback: AsyncCallback<number>): void
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -334,7 +335,7 @@ getFreeSize(): Promise<number>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
返回值
...
...
@@ -360,7 +361,7 @@ getFreeSize(callback: AsyncCallback<number>): void
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -389,7 +390,7 @@ getSystemSize(): Promise<number>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
返回值
...
...
@@ -417,7 +418,7 @@ getSystemSize(callback:AsyncCallback<number>):void
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -438,7 +439,7 @@ getSystemSize(callback:AsyncCallback<number>):void
## storagestatistics.getUserStorageStats<sup>9+</sup>
getUserStorageStats(userId?:
string
): Promise
<
StorageStats
>
getUserStorageStats(userId?:
number
): Promise
<
StorageStats
>
异步获取用户各类别数据大小,以promise方式返回。
...
...
@@ -446,7 +447,7 @@ getUserStorageStats(userId?: string): Promise<StorageStats>
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -473,7 +474,7 @@ getUserStorageStats(userId?: string): Promise<StorageStats>
## storagestatistics.getUserStorageStats<sup>9+</sup>
getUserStorageStats(userId?:
string
, callback:AsyncCallback
<
StorageStats
>
):void
getUserStorageStats(userId?:
number
, callback:AsyncCallback
<
StorageStats
>
):void
异步获取用户各类别数据大小,以callback方式返回。
...
...
@@ -481,7 +482,7 @@ getUserStorageStats(userId?: string, callback:AsyncCallback<StorageStats>)
**系统能力**
:SystemCapability.FileManagement.StorageService.SpatialStatistics
**系统API**
:
该接口为系统接口,三方应用不支持调用
该接口为系统接口,三方应用不支持调用
-
参数
...
...
@@ -505,7 +506,7 @@ getUserStorageStats(userId?: string, callback:AsyncCallback<StorageStats>)
## StorageStats<sup>9+</sup>
**系统能力**
:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics。
该接口为系统接口,三方应用不支持调用
-
属性
| 名称 | 类型 | 说明 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录