* 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)
| 401 | * @param {string} contents |
| 402 | */ |
| 403 | function atomicWriteFileSync(filePath, contents) { |
| 404 | const stagingPath = filePath + '_'; |
| 405 | writeFileSync(stagingPath, contents); |
| 406 | renameSync(stagingPath, filePath); |
| 407 | } |
| 408 | |
| 409 | exports.atomicWriteFileSync = atomicWriteFileSync; |
| 410 |
no outgoing calls
no test coverage detected
searching dependent graphs…