created cleardatabase system

This commit is contained in:
DJj123dj
2022-05-02 11:35:41 +02:00
parent 92c1e8fce0
commit 8e7a98b810
29 changed files with 30 additions and 28 deletions
+28
View File
@@ -0,0 +1,28 @@
const fs = require('fs')
const dataPaths = ["./storage/tickets","./storage/transcripts","./storage/userTickets"]
var index = 0
dataPaths.forEach((path) => {
try {
fs.rmdirSync(path,{recursive:true,force:true})
}catch{
console.log(path,"doesn't exist")
}
setTimeout(() => {
try{
fs.mkdirSync(path)
}catch{
console.log(path,"already exists")
}
index++
},500)
})
setInterval(() => {
if (index >= 3){
console.log("All local data is cleared!")
process.exit(1)
}
},500)