[desktop] Flush file writes

A customer reported a partial export_status.json being written to an external
drive. Forcing a flush to attempt to reduce chances of this happening. Since
this particular code path is only used for writing JSON files (export status and
metadata), we unconditionally enable this for all writes.
This commit is contained in:
Manav Rathi
2024-12-20 15:13:46 +05:30
parent af420a8fc3
commit 9756c178bf

View File

@@ -22,7 +22,7 @@ export const fsReadTextFile = async (filePath: string) =>
fs.readFile(filePath, "utf-8");
export const fsWriteFile = (path: string, contents: string) =>
fs.writeFile(path, contents);
fs.writeFile(path, contents, { flush: true });
export const fsIsDir = async (dirPath: string) => {
if (!existsSync(dirPath)) return false;