0.0.1 • Published 9 years ago

file-encrypt v0.0.1

Weekly downloads
5
License
ISC
Repository
github
Last release
9 years ago

file-encrypt

Simple module for encrypting and decrypting files.

Installation

npm install file-encrypt

Usage

var encrypt = require('file-encrypt');
var input = 'D:/in/input.txt';
var output = 'D:/out/output.txt';
var key = 'Your secret key for encryption and decryption';

encrypt.encryptFile(input, output, key, function(err){
	if(err){
		console.log("Something went wrong", err);
	}
	else{
		console.log("Successfully encrypted");
	}
})
var input = 'D:/in/input.txt'; //encrypted file
var output = 'D:/out/output.txt';
var key = 'Your secret key for encryption and decryption';

encrypt.decryptFile(input, output, key, function(err){
	if(err){
		console.log("Something went wrong", err);
	}
	else{
		console.log("Successfully decrypted");
	}
});

Deafult cipher used for encryption and decryption

aes192

But you can change this sending an another parameter

var input = 'D:/in/input.txt';
var output = 'D:/out/output.txt';
var key = 'Your secret key for encryption and decryption';

encrypt.encryptFile(input, output, key, 'aes-256-gcm' function(err){
	if(err){
		console.log("Something went wrong", err);
	}
	else{
		console.log("Successfully encrypted");
	}
});

If you want the list of ciphers available use

encrypt.getCiphers(function(ciphers){
	console.log(ciphers) // Array of ciphers
});