-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
30 lines (26 loc) · 999 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Dependencies
const Secure_RM = require("secure-rm")
const I2rys = require("./utils/i2rys")
const Fs = require("fs")
//Variables
const Self_Args = process.argv.slice(2)
//Main
if(Self_Args.length == 0){
console.log(`node index.js <directory>
Example: node index.js ./test`)
process.exit()
}
if(!Fs.existsSync(Self_Args[0])){
I2rys.log("yellowish", "CRITICAL", "SRF Debugger:", "Invalid directory path.")
I2rys.log("yellowish", "INFO", "SRF Debugger:", "Exiting...")
process.exit()
}
Secure_RM(`${Self_Args[0]}/*`).then(()=>{
I2rys.log("yellowish", "INFO", "SRF Debugger:", `${Self_Args[0]} files have been deleted permanently, securely & safely.`)
I2rys.log("yellowish", "INFO", "SRF Debugger:", "Exiting...")
process.exit()
}).catch(()=>{
I2rys.log("yellowish", "CRITICAL", "SRF Debugger:", `Unable to delete ${Self_Args[0]} files due to invalid path/low permission.`)
I2rys.log("yellowish", "INFO", "SRF Debugger:", "Exiting...")
process.exit()
})