diff --git a/core/util/src/node/fs.ts b/core/util/src/node/fs.ts index 5c093bb71..28c237a2e 100644 --- a/core/util/src/node/fs.ts +++ b/core/util/src/node/fs.ts @@ -1,5 +1,5 @@ -import {existsSync, readFileSync, writeFileSync, renameSync, mkdirSync} from 'node:fs'; -import {rename, mkdir, writeFile, readFile, rm, symlink} from 'node:fs/promises'; +import {existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync, renameSync} from 'node:fs'; +import {mkdir, writeFile, readFile, rm, symlink, copyFile, rename} from 'node:fs/promises'; import {dirname} from 'node:path'; import {createLogger} from '@alwatr/logger'; @@ -99,6 +99,7 @@ export const readJsonFile = async ( path: string, data: T, + existFile: 'replace' | 'copy' | 'rename' = 'replace', space?: string | number, ): void => { logger.logMethodArgs?.('writeJsonFileSync', path); @@ -118,10 +119,15 @@ export const writeJsonFileSync = ( path: string, data: T, + existFile: 'replace' | 'copy' | 'rename' = 'replace', space?: string | number, ): Promise => { logger.logMethodArgs?.('writeJsonFile', path); @@ -173,10 +180,15 @@ export const writeJsonFile = async