-
Notifications
You must be signed in to change notification settings - Fork 0
/
nfs-locker.js
39 lines (35 loc) · 1.02 KB
/
nfs-locker.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
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
const { Command } = require('commander');
const fs = require("node:fs");
const funcs = require('./funcs');
const program = new Command();
program.version('1.2.0');
program
.command('enc <input> <output> <password>')
.description('Encrypts A File With A Password.')
.action((input, output, password) => {
if (fs.existsSync(input)) {
if (!fs.existsSync(output)) {
funcs.encrypt(input, output, password);
} else {
console.log("Output Path That You Provided Is In Use...");
}
} else {
console.log("Input File That You Provided Does Not Exists...");
}
});
program
.command('dec <input> <output> <password>')
.description('Decrypt A File With A Password.')
.action((input, output, password) => {
if (fs.existsSync(input)) {
if (!fs.existsSync(output)) {
funcs.decrypt(input, output, password);
} else {
console.log("Output Path That You Provided Is In Use...");
}
} else {
console.log("Input File That You Provided Does Not Exists...");
}
});
program.parse(process.argv);