-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
16 lines (16 loc) · 576 Bytes
/
Copy pathcli.ts
File metadata and controls
16 lines (16 loc) · 576 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { SecureFile } from "./securefile";
import minimist from 'minimist';
const args = minimist(process.argv.slice(2));
const key = args.key,
file = args._[0],
method = args.method
const secure = new SecureFile(key)
if(method == 'encrypt') {
const d = secure.encrypt(file)
console.log(`File encrypted and saved as ${d.fileName} to ${d.filePath}`)
} else if(method == 'decrypt') {
const d = secure.decrypt(file)
console.log(`File decrypted and saved as ${d.fileName} to ${d.filePath}`)
} else {
console.log("Invalid method. Use 'encrypt' or 'decrypt'")
}