initial commit. phase 1 complete

This commit is contained in:
2026-05-05 20:45:19 +02:00
parent d9c68313a0
commit 89e058ffac
20631 changed files with 3224610 additions and 43 deletions
+18
View File
@@ -0,0 +1,18 @@
import { unlink, writeFile } from "fs/promises";
import { rename } from "./rename";
export async function writeFileAtomic(filePath, content) {
const tempPath = filePath + ".tmp." + Math.random().toString(36).slice(2);
try {
await writeFile(tempPath, content, "utf-8");
await rename(tempPath, filePath);
} catch (e) {
try {
await unlink(tempPath);
} catch {
// ignore
}
throw e;
}
}
//# sourceMappingURL=write-atomic.js.map