
base64-file-encoder
A Node.js module to base64 encode/decode a file and save it to disk

Installation
Install with npm
:
$ npm install base64-file-encoder --save
Example
const b64File = require('base64-file-encoder');
b64File.encode('foo.txt', 'bar.txt')
.then(function(){
console.log('file was encoded');
})
.catch(function(error){
console.log(error);
});
b64File.encode('foo.txt')
.then(function(){
console.log('file was encoded and overwritten');
})
.catch(function(error){
console.log(error);
});
b64File.decode('bar.txt', 'foo.txt')
.then(function(){
console.log('file was decoded');
})
.catch(function(error){
console.log(error);
});
b64File.decode('bar.txt')
.then(function(){
console.log('file was decoded and overwritten');
})
.catch(function(error){
console.log(error);
});
API
encode(inputFilePath, [outputFilePath])
Base64 encodes the contents of a file and outputs it to another file (outputFilePath) or to the same file (if outputPath is not provided).
This function returns a promise.
decode(inputFilePath, [outputFilePath])
Decodes the contents of a base64 encoded file and outputs it to another file (outputFilePath) or to the same file (if outputPath is not provided).
This function returns a promise.
License
MIT. See LICENSE.md for details.