Atomic file operations for backup system.

Methods

(async, inner) atomicWrite(targetPath, content) → {Promise.<void>}

Writes content atomically via temp file + rename

Parameters:
NameTypeDescription
targetPathstring
contentstring
Returns:
Type: 
Promise.<void>

(inner) atomicWriteSync(targetPath, content)

Parameters:
NameTypeDescription
targetPathstring
contentstring

(async, inner) copyFilePreservingStructure(srcFile, destRoot, cwd) → {Promise.<{original: string, backup: string, size: number}>}

Copies file preserving directory structure relative to cwd

Parameters:
NameTypeDescription
srcFilestring
destRootstring
cwdstring
Returns:
Type: 
Promise.<{original: string, backup: string, size: number}>

(inner) copyFilePreservingStructureSync(srcFile, destRoot, cwd) → {Object}

Parameters:
NameTypeDescription
srcFilestring
destRootstring
cwdstring
Returns:
Type: 
Object

(async, inner) ensureDir(dirPath) → {Promise.<void>}

Parameters:
NameTypeDescription
dirPathstring
Returns:
Type: 
Promise.<void>

(inner) ensureDirSync(dirPath)

Parameters:
NameTypeDescription
dirPathstring

(async, inner) listDirs(parentDir) → {Promise.<Array.<string>>}

Parameters:
NameTypeDescription
parentDirstring
Returns:
Type: 
Promise.<Array.<string>>

(inner) listDirsSync(parentDir) → {Array.<string>}

Parameters:
NameTypeDescription
parentDirstring
Returns:
Type: 
Array.<string>

(async, inner) removeDir(dirPath) → {Promise.<void>}

Parameters:
NameTypeDescription
dirPathstring
Returns:
Type: 
Promise.<void>

(inner) removeDirSync(dirPath)

Parameters:
NameTypeDescription
dirPathstring

(async, inner) restoreFile(backupPath, originalPath) → {Promise.<void>}

Parameters:
NameTypeDescription
backupPathstring
originalPathstring
Returns:
Type: 
Promise.<void>

(inner) restoreFileSync(backupPath, originalPath)

Parameters:
NameTypeDescription
backupPathstring
originalPathstring