Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
Docs
提交
1ccb73eb
D
Docs
项目概览
Tonvia
/
Docs
与 Fork 源项目一致
Fork自
OpenHarmony / Docs
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1ccb73eb
编写于
3月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!16105 bugfix fs修改示例代码文件路径
Merge pull request !16105 from zhuhongtao666/fsdoc
上级
a5a214ff
57ec1445
变更
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
浏览文件 @
1ccb73eb
...
...
@@ -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
"
);
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录