diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md index 78cf11ceb5a292138913d06b4131801f403d34af..8df713bbf5ad8bf9f55d040387ef9258af468e91 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md @@ -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; **示例:** ```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 **示例:** ```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"); ```