fix(server): sync files to disk (#26881)

Ensure that all files are flushed after they've been written.

At current, files are not explicitly flushed to disk, which can cause
data corruption. In extreme circumstances, it's possible that uploaded
files may not ever be persisted at all.
This commit is contained in:
Thomas
2026-03-17 11:33:43 +00:00
committed by GitHub
parent bba4a00eb1
commit 16749ff8ba
2 changed files with 49 additions and 61 deletions

View File

@@ -63,7 +63,7 @@ export class StorageRepository {
}
createWriteStream(filepath: string): Writable {
return createWriteStream(filepath, { flags: 'w' });
return createWriteStream(filepath, { flags: 'w', flush: true });
}
createOrOverwriteFile(filepath: string, buffer: Buffer) {