MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / appendFileSync

Function appendFileSync

source code/utils/fsOperations.ts:470–489  ·  view source on GitHub ↗
(path, data, options)

Source from the content-addressed store, hash-verified

468 },
469
470 appendFileSync(path, data, options) {
471 using _ = slowLogging`fs.appendFileSync(${path}, ${data.length} chars)`
472 // For new files with explicit mode, use 'ax' (atomic create-with-mode) to avoid
473 // TOCTOU race between existence check and open. Fall back to normal append if exists.
474 if (options?.mode !== undefined) {
475 try {
476 const fd = fs.openSync(path, 'ax', options.mode)
477 try {
478 fs.appendFileSync(fd, data)
479 } finally {
480 fs.closeSync(fd)
481 }
482 return
483 } catch (e) {
484 if (getErrnoCode(e) !== 'EEXIST') throw e
485 // File exists — fall through to normal append
486 }
487 }
488 fs.appendFileSync(path, data)
489 },
490
491 copyFileSync(src, dest) {
492 using _ = slowLogging`fs.copyFileSync(${src} → ${dest})`

Callers 2

getRenderContextFunction · 0.90
resetAfterCommitFunction · 0.90

Calls 1

getErrnoCodeFunction · 0.85

Tested by

no test coverage detected