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>
- ~zipLogs(lastMonth) ⇒
Promise.<Number>
- ~zipDemos(lastMonth) ⇒
Promise.<Number>
- ~deleteLogs() ⇒
Promise.<Void>
- ~deleteDemos() ⇒
Promise.<Void>
- ~cleanUp(top, weapons, totalPlayers, bannedPlayers, lastUpdate, testMode) ⇒
Promise.<Void>
- ~saveTop(lastMonth, top, weapons, totalPlayers, bannedPlayers, lastUpdate) ⇒
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
});
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
});
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
});
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!!
});
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
});