From ef883935e370e005a143adb924f086cc390ad81b Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Tue, 15 Jul 2025 10:54:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98=EF=BC=9A?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E9=97=AA=E9=80=80=E6=88=96=E6=8A=A5=E9=94=99?= =?UTF-8?q?=EF=BC=8C=E6=89=BE=E4=B8=8D=E5=88=B0=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=88=96=E6=96=87=E4=BB=B6=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=20=E8=A7=A3=E5=86=B3=E6=96=B9=E6=B3=95=EF=BC=9A=E5=BD=93?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E9=80=9A?= =?UTF-8?q?=E8=BF=87fileIo.OpenMode.CREATE=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreFileKit/entry/src/main/ets/pages/StreamDataToFile.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CoreFileKit/entry/src/main/ets/pages/StreamDataToFile.ets b/CoreFileKit/entry/src/main/ets/pages/StreamDataToFile.ets index 087b52e..55851ec 100644 --- a/CoreFileKit/entry/src/main/ets/pages/StreamDataToFile.ets +++ b/CoreFileKit/entry/src/main/ets/pages/StreamDataToFile.ets @@ -28,7 +28,7 @@ export struct ContinuousWrite { aboutToAppear(): void { let context = this.getUIContext().getHostContext(); // Sandbox Path let filePath = context!.filesDir + '/test.txt'; - let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE); + let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let arrayBuffer = new ArrayBuffer(4096); fileIo.read(file.fd, arrayBuffer).then((readLen: number) => { console.info(readLen.toString()); @@ -58,4 +58,5 @@ export struct ContinuousWrite { .width('100%') } } + // [End StreamDataToFile] \ No newline at end of file -- Gitee