
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
base64-file-encoder
Advanced tools
A Node.js module to base64 encode/decode a file and save it to disk
Install with npm
:
$ npm install base64-file-encoder --save
const b64File = require('base64-file-encoder');
// base64 encodes the content of foo.txt and outputs it to bar.txt
b64File.encode('foo.txt', 'bar.txt')
.then(function(){
// if foo.txt content was 'foo', bar.txt content will be 'Zm9v'
console.log('file was encoded');
})
.catch(function(error){
console.log(error);
});
// base64 encodes the content of foo.txt and outputs it to the same
// file (i.e. overwrites it)
b64File.encode('foo.txt')
.then(function(){
console.log('file was encoded and overwritten');
})
.catch(function(error){
console.log(error);
});
// base64 decodes the content of bar.txt and outputs it to foo.txt
b64File.decode('bar.txt', 'foo.txt')
.then(function(){
// if bar.txt content was 'Zm9v', foo.txt content will be 'foo'
console.log('file was decoded');
})
.catch(function(error){
console.log(error);
});
// base64 decodes the content of bar.txt and outputs it to the same
// file (i.e. overwrites it)
b64File.decode('bar.txt')
.then(function(){
console.log('file was decoded and overwritten');
})
.catch(function(error){
console.log(error);
});
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.
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.
MIT. See LICENSE.md for details.
FAQs
base64 encode/decode a file and save it to disk
The npm package base64-file-encoder receives a total of 2 weekly downloads. As such, base64-file-encoder popularity was classified as not popular.
We found that base64-file-encoder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.