This repository has been archived on 2026-05-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
novarix-networks-homepage/node_modules/next/dist/esm/lib/fs/write-atomic.js
T
Kismet Hasanaj 34dc9aec52 .
2026-05-02 20:07:02 +02:00

18 lines
499 B
JavaScript

import { unlinkSync, writeFileSync } from 'fs';
import { renameSync } from './rename';
export function writeFileAtomic(filePath, content) {
const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2);
try {
writeFileSync(tempPath, content, 'utf-8');
renameSync(tempPath, filePath);
} catch (e) {
try {
unlinkSync(tempPath);
} catch {
// ignore
}
throw e;
}
}
//# sourceMappingURL=write-atomic.js.map