aboutsummaryrefslogtreecommitdiff
path: root/core/headClean.js
blob: 31ce5a911934fb0627888b3c8a0a9079541180b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const fs = require('fs');

module.exports = () => {
    fs.readdir("./cache", (error, files) => {
        if (error) {
            console.log(chalk.gray(cluster.worker.id + " ") + chalk.yellow("warn:") + " unable to cleanup cache: " + error.message);
        } else {
            files.forEach((file) => {
                if (file.startsWith("HAD_")) {
                    fs.unlink("./cache/" + file, () => {});
                }
            })
        }
    })
}