joox-crypto/joox-decrypt

22 lines
552 B
Plaintext
Raw Normal View History

2021-12-19 18:19:25 +00:00
#!/usr/bin/env node
const jooxFactory = require(".");
2021-12-19 18:19:25 +00:00
const fs = require("fs");
if (process.argv.length < 5) {
console.info(
"Usage: %s <uuidv2> <encrypted_path> <decrypted_path>",
process.argv[1]
);
return;
}
const [, , uuid, inputPath, outputPath] = process.argv;
const inputBuffer = fs.readFileSync(inputPath);
const decryptor = jooxFactory(inputBuffer, uuid);
2021-12-19 18:19:25 +00:00
const result = decryptor.decryptFile(inputBuffer);
const outputHandle = fs.openSync(outputPath, "w");
for (const block of result) {
fs.writeSync(outputHandle, block);
}