mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
moving log file if its not from today
This commit is contained in:
parent
2d6baa2549
commit
28af84148e
2 changed files with 35 additions and 0 deletions
|
@ -13,6 +13,8 @@ export default {
|
|||
formatUrl: formatUrl,
|
||||
deleteFile: deleteFile,
|
||||
uploadFile: uploadFile,
|
||||
statFile: statFile,
|
||||
renameFile: renameFile,
|
||||
}
|
||||
|
||||
import fs from 'fs'
|
||||
|
@ -232,3 +234,20 @@ function uploadFile(req: Request, path: string): Promise<any> {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
function statFile(file: string): any {
|
||||
if (FileExists(file)) {
|
||||
return fs.statSync(file)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function renameFile(oldPath: string, newPath: string): any {
|
||||
if (FileExists(oldPath)) {
|
||||
fs.renameSync(oldPath, newPath)
|
||||
return newPath
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue