From 1394a2eb12586f27fa857addd850e9de182ca490 Mon Sep 17 00:00:00 2001 From: tillvit Date: Mon, 7 Oct 2024 14:37:04 -0400 Subject: [PATCH] Truncate after write for NodeFileHandler --- app/src/util/file-handler/NodeFileHandler.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/util/file-handler/NodeFileHandler.ts b/app/src/util/file-handler/NodeFileHandler.ts index 723b699b..75da015d 100644 --- a/app/src/util/file-handler/NodeFileHandler.ts +++ b/app/src/util/file-handler/NodeFileHandler.ts @@ -169,8 +169,10 @@ export class NodeFileHandler implements BaseFileHandler { } private async writeHandle(handle: FileSystemFileHandle, data: Blob | string) { + const length = data instanceof Blob ? data.size : data.length const writable = await handle.createWritable() await writable.write(data) + await writable.truncate(length) await writable.close() }