UNPKG

@voerkai18n/utils

Version:

utils for voerkai18n

15 lines (12 loc) 337 B
import fs from 'node:fs' import path from 'node:path' export function getBackupFile(file:string){ let i = 0 const extName = path.extname(file) while(true){ const bakFile = file.replace(extName,`.bak.${i++}${extName}`) if(!fs.existsSync(bakFile)){ return bakFile } } }