Sorgente pubblicata
Scarica sorgente ZIP
CH-J Server Manager
Sfoglia directory e file per una specifica release di applicazioni.
CH-J / Server Manager
339 file
core-20261014T184258Z-3fbed0b93fdf
Aggiunto: Data non registrata · Costruito:
1
"use strict";3
const crypto = require("node:crypto");4
const fs = require("node:fs");5
const path = require("node:path");7
function atomicWriteFile(filePath, content, options = {}) {8
fs.mkdirSync(path.dirname(filePath), { recursive: true });9
const tempPath = `${filePath}.tmp-${crypto.randomBytes(6).toString("hex")}`;10
const backupPath = `${filePath}.replace-backup`;11
fs.writeFileSync(tempPath, content, { mode: options.mode || 0o600, encoding: options.encoding });12
try {13
if (process.platform === "win32" && fs.existsSync(filePath)) {14
try { fs.unlinkSync(backupPath); } catch {}15
fs.renameSync(filePath, backupPath);16
try {17
fs.renameSync(tempPath, filePath);18
fs.unlinkSync(backupPath);19
} catch (error) {20
try { fs.renameSync(backupPath, filePath); } catch {}21
throw error;22
}23
} else {24
fs.renameSync(tempPath, filePath);25
}26
} catch (error) {27
try { fs.unlinkSync(tempPath); } catch {}28
throw error;29
}30
}32
function atomicWriteJson(filePath, value) {33
atomicWriteFile(filePath, `${JSON.stringify(value, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });34
}36
module.exports = { atomicWriteFile, atomicWriteJson };SHA-256
7aee82e6b371127f5467bd9f5b77e57dfccbe53d8b7eed9a675767ff4c8c5610CH-J Proprietary Software License 1.14 · La sorgente è fornita sotto CH-J Proprietary Software License 1.14. La sua disponibilità non modifica i termini di licenza o concede diritti aggiuntivi.
Archivio SHA-256
3df08cf5e899262a6ce92d7ec2caf5c42b683f1f2b57055662b845ff7dde67a8