explicity truncate files when not keeping existing data
Release / release (push) Successful in 23s

This commit is contained in:
2026-02-15 20:51:17 -08:00
parent bbd975feb6
commit e99fc35e25
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -14,8 +14,9 @@ export default class NodeFileSystemWritableFileStream extends WritableStream imp
constructor(name: string, options: FileSystemCreateWritableOptions = {}) {
name = path.normalize(name)
let flags = 'w'
if (!options.keepExistingData) flags = 'r+'
if (options.keepExistingData) flags = 'r+'
const fd = fs.openSync(name, flags)
if (!options.keepExistingData) fs.ftruncateSync(fd, 0)
super(Writable.toWeb(fs.createWriteStream(name, { "fd": fd })))
this.#fd = fd
}