multi-encrypt
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -104,9 +104,15 @@ /** | ||
.forEach(file => { | ||
// When we get here | ||
if (file && fs.existsSync(file)) { | ||
console.log(chalk.green(`Encrypting ${file}...`)); | ||
codec(file, tempFile); | ||
encrypted[file] = fs.readFileSync(tempFile).toString('base64'); | ||
totalFiles++; | ||
} else { | ||
if (file) console.log(chalk.red(`File not found: ${file}`)); | ||
} | ||
}); | ||
// All done... | ||
fs.writeFileSync('./encrypted.json', JSON.stringify(encrypted, null, 4)); | ||
fs.unlinkSync(tempFile); | ||
if (fs.existsSync(tempFile)) fs.unlinkSync(tempFile); | ||
handleCipherSuccess(totalFiles, command + 'ed'); | ||
@@ -122,3 +128,3 @@ } else { | ||
// All done... | ||
fs.unlinkSync(tempFile); | ||
if (fs.existsSync(tempFile)) fs.unlinkSync(tempFile); | ||
handleCipherSuccess(totalFiles, command + 'ed'); | ||
@@ -236,4 +242,6 @@ } | ||
function handleCipherSuccess(files, command) { | ||
const extra = command === 'encrypted' ? | ||
'\nEncrypted files are located in encrypted.json in this folder.' : ''; | ||
console.log(chalk.green( | ||
`\nSuccess!\n${files} file(s) ${command}.` | ||
`\nSuccess!\n${files} file(s) ${command}.${extra}` | ||
)); | ||
@@ -240,0 +248,0 @@ } |
@@ -14,2 +14,4 @@ #!/usr/bin/env node | ||
console.log(`Multi-Encrypt v${Package.version}\n`); | ||
/** | ||
@@ -16,0 +18,0 @@ * Issues the password security warning, if relevant. |
{ | ||
"name": "multi-encrypt", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A simple no-install solution to encrypt/decrypt multiple files in a public repo", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
45723
1190