Socket
Socket
Sign inDemoInstall

file-encryptor

Package Overview
Dependencies
0
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-encryptor


Version published
Weekly downloads
2.6K
decreased by-43.63%
Maintainers
3
Install size
5.88 kB
Created
Weekly downloads
 

Readme

Source

file-encryptor

Encrypts files using Node's built-in Cipher class. Encryption is stream-based for low memory footprint.

Getting Started

Install the module:

npm install file-encryptor

Use it in your script:

var encryptor = require('file-encryptor');

var key = 'My Super Secret Key';

// Encrypt file.
encryptor.encryptFile('input_file.txt', 'encrypted.dat', key, function(err) {
  // Encryption complete.
});

...

// Decrypt file.
encryptor.decryptFile('encrypted.dat', 'output_file.txt', key, function(err) {
  // Decryption complete.
});

The input file will be streamed through the Cipher and to the output file. If the output files does not exists, it will be created. If the output file already exists, it will be truncated.

Change Cipher Algorithm

By default the "aes192" cipher algorithm is used. This can be changed by passing a new algorithm string as an option.

Available algorithms can be found by executing:

openssl list-cipher-algorithms

Setting algorithm option:

var key = 'My Super Secret Key';
var options = { algorithm: 'aes256' };

encryptor.encryptFile('input_file.txt', 'encrypted.dat', key, options, function(err) {
  // Decryption complete;
});

...

encryptor.decryptFile('encrypted.dat', 'outputfile.txt', key, options, function(err) {
  // Encryption complete;
});

License

Copyright (c) 2013 Modulus Licensed under the MIT license.

FAQs

Last updated on 18 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc