From 0f79e708bf07721b73ea41e5d341be08e8ea4dce Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 7 Mar 2021 18:29:17 +0100 Subject: Initial commit --- core/headClean.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 core/headClean.js (limited to 'core/headClean.js') diff --git a/core/headClean.js b/core/headClean.js new file mode 100644 index 0000000..31ce5a9 --- /dev/null +++ b/core/headClean.js @@ -0,0 +1,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, () => {}); + } + }) + } + }) +} \ No newline at end of file -- cgit