From 12394ec25d327d08715973ad3b77db45593d08ea Mon Sep 17 00:00:00 2001 From: hujinyun Date: Thu, 19 Dec 2024 18:29:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[Issues:=20#IBCHD8]=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=86=99=E5=85=A5=E6=96=87=E4=BB=B6=E6=97=B6=EF=BC=8C=E9=80=A0?= =?UTF-8?q?=E6=88=90=E4=B8=A4=E6=AC=A1=E6=96=87=E4=BB=B6=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hujinyun --- harmony/fs/src/main/ets/FsTurboModule.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/harmony/fs/src/main/ets/FsTurboModule.ts b/harmony/fs/src/main/ets/FsTurboModule.ts index d29d7cb..6b0c36c 100644 --- a/harmony/fs/src/main/ets/FsTurboModule.ts +++ b/harmony/fs/src/main/ets/FsTurboModule.ts @@ -331,7 +331,7 @@ export class FsTurboModule extends TurboModule implements TM.ReactNativeFs.Spec // base64 decode 解码 let result = buffer.from(contentStr, this.BASE64); // 读写创建 文件不存在则创建文件 - let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC); + let file = fs.openSync(path, fs.OpenMode.WRITE_ONLY | fs.OpenMode.CREATE | fs.OpenMode.TRUNC); fs.write(file.fd, result.buffer, (err: BusinessError, writeLen: number) => { if (err) { reject('Directory could not be created'); @@ -349,7 +349,7 @@ export class FsTurboModule extends TurboModule implements TM.ReactNativeFs.Spec // base64 decode 解码 let result = buffer.from(contentStr, this.BASE64).toString(this.UTF8); // 读写创建 文件内容追加到末尾 - let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.APPEND); + let file = fs.openSync(path, fs.OpenMode.WRITE_ONLY | fs.OpenMode.APPEND); fs.write(file.fd, result, (err: BusinessError, writeLen: number) => { if (err) { reject('Directory could not be created'); @@ -483,7 +483,7 @@ export class FsTurboModule extends TurboModule implements TM.ReactNativeFs.Spec write(filepath: string, contents: string, position: number): Promise { return new Promise((resolve, reject) => { let result = buffer.from(contents, this.BASE64).toString(this.UTF8); - let file = fs.openSync(filepath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let file = fs.openSync(filepath, fs.OpenMode.WRITE_ONLY | fs.OpenMode.CREATE); let writeOption: WriteOptions = { offset: fs.statSync(filepath).size }; -- Gitee