Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
57ec1445
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看板
提交
57ec1445
编写于
3月 15, 2023
作者:
1
18721213663
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fs_fix_path
Signed-off-by:
N
18721213663
<
zhuhongtao12@huawei.com
>
上级
50c46a4b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
25 addition
and
25 deletion
+25
-25
zh-cn/application-dev/reference/apis/js-apis-file-fs.md
zh-cn/application-dev/reference/apis/js-apis-file-fs.md
+25
-25
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-file-fs.md
浏览文件 @
57ec1445
...
...
@@ -65,7 +65,7 @@ stat(file: string|number): Promise<Stat>
**示例:**
```
js
let
filePath
=
pathDir
+
"
test.txt
"
;
let
filePath
=
pathDir
+
"
/
test.txt
"
;
fs
.
stat
(
filePath
).
then
((
stat
)
=>
{
console
.
info
(
"
get file info succeed, the size of file is
"
+
stat
.
size
);
}).
catch
((
err
)
=>
{
...
...
@@ -330,8 +330,8 @@ copyFile(src: string|number, dest: string|number, mode?: number): Promise<voi
**示例:**
```
js
let
srcPath
=
pathDir
+
"
srcDir/test.txt
"
;
let
dstPath
=
pathDir
+
"
dstDir/test.txt
"
;
let
srcPath
=
pathDir
+
"
/
srcDir/test.txt
"
;
let
dstPath
=
pathDir
+
"
/
dstDir/test.txt
"
;
fs
.
copyFile
(
srcPath
,
dstPath
).
then
(()
=>
{
console
.
info
(
"
copy file succeed
"
);
}).
catch
((
err
)
=>
{
...
...
@@ -359,8 +359,8 @@ copyFile(src: string|number, dest: string|number, mode?: number, callback: Async
**示例:**
```
js
let
srcPath
=
pathDir
+
"
srcDir/test.txt
"
;
let
dstPath
=
pathDir
+
"
dstDir/test.txt
"
;
let
srcPath
=
pathDir
+
"
/
srcDir/test.txt
"
;
let
dstPath
=
pathDir
+
"
/
dstDir/test.txt
"
;
fs
.
copyFile
(
srcPath
,
dstPath
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
copy file failed with error message:
"
+
err
.
message
+
"
, error code:
"
+
err
.
code
);
...
...
@@ -390,8 +390,8 @@ copyFileSync(src: string|number, dest: string|number, mode?: number): void
**示例:**
```
js
let
srcPath
=
pathDir
+
"
srcDir/test.txt
"
;
let
dstPath
=
pathDir
+
"
dstDir/test.txt
"
;
let
srcPath
=
pathDir
+
"
/
srcDir/test.txt
"
;
let
dstPath
=
pathDir
+
"
/
dstDir/test.txt
"
;
fs
.
copyFileSync
(
srcPath
,
dstPath
);
```
...
...
@@ -419,7 +419,7 @@ mkdir(path: string): Promise<void>
**示例:**
```
js
let
dirPath
=
pathDir
+
'
/testDir
'
;
let
dirPath
=
pathDir
+
"
/testDir
"
;
fs
.
mkdir
(
dirPath
).
then
(()
=>
{
console
.
info
(
"
mkdir succeed
"
);
}).
catch
((
err
)
=>
{
...
...
@@ -446,7 +446,7 @@ mkdir(path: string, callback: AsyncCallback<void>): void
**示例:**
```
js
let
dirPath
=
pathDir
+
'
/testDir
'
;
let
dirPath
=
pathDir
+
"
/testDir
"
;
fs
.
mkdir
(
dirPath
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
mkdir failed with error message:
"
+
err
.
message
+
"
, error code:
"
+
err
.
code
);
...
...
@@ -474,7 +474,7 @@ mkdirSync(path: string): void
**示例:**
```
js
let
dirPath
=
pathDir
+
'
/testDir
'
;
let
dirPath
=
pathDir
+
"
/testDir
"
;
fs
.
mkdirSync
(
dirPath
);
```
...
...
@@ -698,7 +698,7 @@ rmdir(path: string): Promise<void>
**示例:**
```
js
let
dirPath
=
pathDir
+
'
/testDir
'
;
let
dirPath
=
pathDir
+
"
/testDir
"
;
fs
.
rmdir
(
dirPath
).
then
(()
=>
{
console
.
info
(
"
rmdir succeed
"
);
}).
catch
((
err
)
=>
{
...
...
@@ -725,7 +725,7 @@ rmdir(path: string, callback: AsyncCallback<void>): void
**示例:**
```
js
let
dirPath
=
pathDir
+
'
/testDir
'
;
let
dirPath
=
pathDir
+
"
/testDir
"
;
fs
.
rmdir
(
dirPath
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
rmdir failed with error message:
"
+
err
.
message
+
"
, error code:
"
+
err
.
code
);
...
...
@@ -753,7 +753,7 @@ rmdirSync(path: string): void
**示例:**
```
js
let
dirPath
=
pathDir
+
'
/testDir
'
;
let
dirPath
=
pathDir
+
"
/testDir
"
;
fs
.
rmdirSync
(
dirPath
);
```
...
...
@@ -1235,7 +1235,7 @@ rename(oldPath: string, newPath: string): Promise<void>
```
js
let
srcFile
=
pathDir
+
"
/test.txt
"
;
let
dstFile
=
pathDir
+
'
/new.txt
'
;
let
dstFile
=
pathDir
+
"
/new.txt
"
;
fs
.
rename
(
srcFile
,
dstFile
).
then
(()
=>
{
console
.
info
(
"
rename succeed
"
);
}).
catch
((
err
)
=>
{
...
...
@@ -1263,7 +1263,7 @@ rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): v
```
js
let
srcFile
=
pathDir
+
"
/test.txt
"
;
let
dstFile
=
pathDir
+
'
/new.txt
'
;
let
dstFile
=
pathDir
+
"
/new.txt
"
;
fs
.
rename
(
srcFile
,
dstFile
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
rename failed with error message:
"
+
err
.
message
+
"
, error code:
"
+
err
.
code
);
...
...
@@ -1292,7 +1292,7 @@ renameSync(oldPath: string, newPath: string): void
```
js
let
srcFile
=
pathDir
+
"
/test.txt
"
;
let
dstFile
=
pathDir
+
'
/new.txt
'
;
let
dstFile
=
pathDir
+
"
/new.txt
"
;
fs
.
renameSync
(
srcFile
,
dstFile
);
```
...
...
@@ -1498,7 +1498,7 @@ symlink(target: string, srcPath: string): Promise<void>
```
js
let
srcFile
=
pathDir
+
"
/test.txt
"
;
let
dstFile
=
pathDir
+
'
/test
'
;
let
dstFile
=
pathDir
+
"
/test
"
;
fs
.
symlink
(
srcFile
,
dstFile
).
then
(()
=>
{
console
.
info
(
"
symlink succeed
"
);
}).
catch
((
err
)
=>
{
...
...
@@ -1526,7 +1526,7 @@ symlink(target: string, srcPath: string, callback: AsyncCallback<void>): v
```
js
let
srcFile
=
pathDir
+
"
/test.txt
"
;
let
dstFile
=
pathDir
+
'
/test
'
;
let
dstFile
=
pathDir
+
"
/test
"
;
fs
.
symlink
(
srcFile
,
dstFile
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
symlink failed with error message:
"
+
err
.
message
+
"
, error code:
"
+
err
.
code
);
...
...
@@ -1555,7 +1555,7 @@ symlinkSync(target: string, srcPath: string): void
```
js
let
srcFile
=
pathDir
+
"
/test.txt
"
;
let
dstFile
=
pathDir
+
'
/test
'
;
let
dstFile
=
pathDir
+
"
/test
"
;
fs
.
symlinkSync
(
srcFile
,
dstFile
);
```
...
...
@@ -1733,8 +1733,8 @@ moveFile(src: string, dest: string, mode?: number): Promise<void>;
**示例:**
```
js
let
srcPath
=
pathDir
+
'
/source.txt
'
;
let
destPath
=
pathDir
+
'
/dest.txt
'
;
let
srcPath
=
pathDir
+
"
/source.txt
"
;
let
destPath
=
pathDir
+
"
/dest.txt
"
;
fs
.
moveFile
(
srcPath
,
destPath
,
0
).
then
(()
=>
{
console
.
info
(
"
move file succeed
"
);
}).
catch
((
err
)
=>
{
...
...
@@ -1762,8 +1762,8 @@ moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback<void>
**示例:**
```
js
let
srcPath
=
pathDir
+
'
/source.txt
'
;
let
destPath
=
pathDir
+
'
/dest.txt
'
;
let
srcPath
=
pathDir
+
"
/source.txt
"
;
let
destPath
=
pathDir
+
"
/dest.txt
"
;
fs
.
moveFile
(
srcPath
,
destPath
,
0
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
move file failed with error message:
"
+
err
.
message
+
"
, error code:
"
+
err
.
code
);
...
...
@@ -1792,8 +1792,8 @@ moveFile(src: string, dest: string, mode?: number): void;
**示例:**
```
js
let
srcPath
=
pathDir
+
'
/source.txt
'
;
let
destPath
=
pathDir
+
'
/dest.txt
'
;
let
srcPath
=
pathDir
+
"
/source.txt
"
;
let
destPath
=
pathDir
+
"
/dest.txt
"
;
fs
.
moveFileSync
(
srcPath
,
destPath
,
0
);
console
.
info
(
"
move file succeed
"
);
```
...
...
Miykael_xxm
🚴
@xiongjiamu
mentioned in commit
7dd2ca10
·
3月 16, 2023
mentioned in commit
7dd2ca10
mentioned in commit 7dd2ca10e71aca6ebfa347fd9af51d43325d8f41
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录