Skip to content

Commit

Permalink
Truncate after write for NodeFileHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
tillvit committed Oct 7, 2024
1 parent dbf65a6 commit 1394a2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/util/file-handler/NodeFileHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 1394a2e

Please sign in to comment.