22 lines
552 B
JavaScript
22 lines
552 B
JavaScript
#!/usr/bin/env node
|
|
const jooxFactory = require(".");
|
|
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);
|
|
const result = decryptor.decryptFile(inputBuffer);
|
|
const outputHandle = fs.openSync(outputPath, "w");
|
|
|
|
for (const block of result) {
|
|
fs.writeSync(outputHandle, block);
|
|
}
|