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 = ;// base64 encodes the content of foo.txt and outputs it to bar.txtb64File;// base64 encodes the content of foo.txt and outputs it to the same// file (i.e. overwrites it)b64File;// base64 decodes the content of bar.txt and outputs it to foo.txtb64File;// base64 decodes the content of bar.txt and outputs it to the same// file (i.e. overwrites it)b64File;
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.