MCPcopy
hub / github.com/rollup/rollup / atomicWriteFileSync

Function atomicWriteFileSync

test/testHelpers.js:403–407  ·  view source on GitHub ↗

* Workaround a race condition in fs.writeFileSync that temporarily creates * an empty file for a brief moment which may be read by rollup watch - even * if the content being overwritten is identical. * * @param {string} filePath * @param {string} contents

(filePath, contents)

Source from the content-addressed store, hash-verified

401 * @param {string} contents
402 */
403function atomicWriteFileSync(filePath, contents) {
404 const stagingPath = filePath + '_';
405 writeFileSync(stagingPath, contents);
406 renameSync(stagingPath, filePath);
407}
408
409exports.atomicWriteFileSync = atomicWriteFileSync;
410

Callers 10

writeFileFunction · 0.85
abortOnStderrFunction · 0.85
abortOnStderrFunction · 0.85
abortOnStderrFunction · 0.85
abortOnStderrFunction · 0.85
abortOnStderrFunction · 0.85
abortOnStderrFunction · 0.85
transformFunction · 0.85
index.jsFile · 0.85
writeBundleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…