MCPcopy
hub / github.com/Doorman11991/smallcode / writeAtomic

Function writeAtomic

src/session/contract.js:84–89  ·  view source on GitHub ↗
(filePath, content)

Source from the content-addressed store, hash-verified

82// ─── Atomic writes ───────────────────────────────────────────────────────────
83
84function writeAtomic(filePath, content) {
85 fs.mkdirSync(path.dirname(filePath), { recursive: true });
86 const tmp = filePath + '.' + crypto.randomBytes(4).toString('hex') + '.tmp';
87 fs.writeFileSync(tmp, content, { mode: FILE_MODE });
88 fs.renameSync(tmp, filePath);
89}
90
91function appendJsonl(filePath, obj) {
92 fs.mkdirSync(path.dirname(filePath), { recursive: true });

Callers 2

activateMethod · 0.85
saveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected