Skip to content

Latest commit

 

History

History
executable file
·
123 lines (99 loc) · 5.37 KB

fileCleanup-doc.md

File metadata and controls

executable file
·
123 lines (99 loc) · 5.37 KB

modules/fileCleanup

make a zip and clean up previous months files

Requires: module:path, module:fs, module:modules/loadConfig.js, module:child_process, module:colors, module:modules/Timer, module:modules/printer.js

modules/fileCleanup~saveTop(lastMonth, top, weapons, totalPlayers, bannedPlayers, lastUpdate) ⇒ Promise.<Number>

saves top data before log clear

Kind: inner method of modules/fileCleanup
Returns: Promise.<Number> - lastmonth time string

Param Type Description
lastMonth Number new Date() output for the time cleanup() was run
top Array over 100 kills by kdr
weapons Array weapon stat data
totalPlayers Number count of players
bannedPlayers Array list of banned players
lastUpdate Number new Date() output

Example (Example usage of saveTop() function.)

saveTop(1609123414390, [ 'players with over 100 kills sorted by kdr'], [ 'weapons' ], 212, [ 'banned players' ], 1609123414390).then(time => {
// time = 1609123414390
});

modules/fileCleanup~zipLogs(lastMonth) ⇒ Promise.<Number>

zip log files before cleanUp deletes them

Kind: inner method of modules/fileCleanup
Returns: Promise.<Number> - lastmonth time string

Param Type Description
lastMonth Number new Date() output for the time cleanup() was run

Example (Example usage of zipLogs() function.)

zipLogs(1609123414390).then(time => {
// time = 1609123414390
});

modules/fileCleanup~zipDemos(lastMonth) ⇒ Promise.<Number>

will create a zip of all demo files in game server directory

Kind: inner method of modules/fileCleanup
Returns: Promise.<Number> - lastmonth time string

Param Type Description
lastMonth Number new Date() output for the time cleanup() was run

Example (Example usage of zipDemos() function.)

zipDemos(1609123414390).then(time => {
// time = 1609123414390
});

modules/fileCleanup~deleteLogs() ⇒ Promise.<Void>

will remove all log files from logs folder can not be undone

Kind: inner method of modules/fileCleanup
Returns: Promise.<Void> - nothing
Example (Example usage of deleteLogs() function.)

deleteLogs().then(_ => {
// logs are gone!!
});

modules/fileCleanup~deleteDemos() ⇒ Promise.<Void>

will remove all demo files from game folder can not be undone

Kind: inner method of modules/fileCleanup
Returns: Promise.<Void> - nothing
Example (Example usage of deleteDemos() function.)

deleteDemos().then(_ => {
// demos are gone!!
});

modules/fileCleanup~cleanUp(top, weapons, totalPlayers, bannedPlayers, lastUpdate, testMode) ⇒ Promise.<Void>

end of month file cleanup process

Kind: inner method of modules/fileCleanup
Returns: Promise.<Void> - nothing

Param Type Description
top Array over 100 kills by kdr
weapons Array weapon stat data
totalPlayers Number count of players
bannedPlayers Array list of banned players
lastUpdate Number new Date() output
testMode Boolean true: will NOT delete log and demo files and will delete zip 15 seconds after generating, false: will delete files and keep the generated zip

Example (Example usage of cleanUp() function.)

cleanUp([ 'players with over 100 kills sorted by kdr'], [ 'weapons' ], 212, [ 'banned players' ], 1609123414390, false).then(_ => {
 // cleanup complete
});