From a03184216b66135f16d2573ce18bd74a251fbe90 Mon Sep 17 00:00:00 2001 From: 18721213663 Date: Thu, 15 Jun 2023 11:16:40 +0800 Subject: [PATCH] bugfix_fs_lock Signed-off-by: 18721213663 --- zh-cn/application-dev/reference/apis/js-apis-file-fs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 9a21b42b44..6610fa15a0 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 @@ -3187,7 +3187,7 @@ lock(exclusive?: boolean): Promise\ **示例:** ```js - let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); file.lock(true).then(() => { console.log("lock file successful"); }).catch((err) => { @@ -3217,7 +3217,7 @@ lock(exclusive?: boolean, callback: AsyncCallback\): void **示例:** ```js - let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); file.lock(true, (err) => { if (err) { console.info("lock file failed with error message: " + err.message + ", error code: " + err.code); @@ -3248,7 +3248,7 @@ tryLock(exclusive?: boolean): void **示例:** ```js - let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); file.tryLock(true); console.log("lock file successful"); ``` @@ -3268,7 +3268,7 @@ unlock(): void **示例:** ```js - let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); file.tryLock(true); file.unlock(); console.log("unlock file successful"); -- GitLab