Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
base64-min
Advanced tools
Readme
Disclaimer: For node versions < 4 use the 1.2.0 version.
This modules can be used to encoding & decoding messages (strings) and files using base64.
I'm trying to add new features based on other packages to get an all in one npm module. Actually base64-min can encode and decode: strings, files and strings with XOR encrytion.
It's minimalist and focused in the best javascript performance.
At cmd, type:
$ npm install base64-min
or to install this package globally, use:
$ npm install -g base64-min
$ cd ./node_modules/base64-min/
$ npm install
$ npm test
$ cd ./node_modules/base64-min/
$ npm install
$ npm test --coverage
To load module functionalities, you must use the require.js properties integrated in node.js.
Example:
var base64 = require('base64-min');
This method is used to encode a plain-text string to a encoded string in base64.
str
- The string you want to encode.type
- Encoding Type (This argument is optional) | Available types: 'MIME'.base64.encode('base64-min npm module'); // result = YmFzZTY0LW1pbiBucG0gbW9kdWxl
base64.encode('base64-min npm module', 'MIME'); // result = YmFzZTY0LW1pbiBucG0gbW9kdWxl
// encoded string in base64, using MIME constraints
This method is used to decode a the base64 message to a plain-text string.
str
- The message (in base64) you want to decode.base64.decode('YmFzZTY0LW1pbiBucG0gbW9kdWxl'); // result = base64-min npm module
This method is used to encode files into base64 string.
file
- The file path of the you want to encode.base64.encodeFile('original.png');
This method is used to decode messages and save the result in one file (Tested and functional with PNG Files).
str
- The message (in base64) you want to decode.file
- The file path of the you want to save.base64.decodeToFile('ZGF0YQ==', 'result.png') ;
This method is used to encode messages and encrypt messages using a key (XOR Encryption - Fast and "Secure").
str
- The message in plain-text.key
- The key you want to encrypt your message.base64.encodeWithKey('base64-min npm module', 'victorfern91'); // result = FAgQEVlGSwgbABlfBgRDGQAWEwkX
//(in plain text is YFK_C )
str
- The message in base64.key
- The key used to encrypt this message.//Decoding with wrong key
base64.decodeWithKey('FAgQEVlGSwgbABlfBgRDGQAWEwkX', 'npm module'); // result = zx}14)/}wew/k$.vdcly
//Decoding with correct key
base64.decodeWithKey('FAgQEVlGSwgbABlfBgRDGQAWEwkX', 'victorfern91'); // result = base64-min npm module
FAQs
Minimalist package, focused in best performance to encode and decode base64.
The npm package base64-min receives a total of 2,002 weekly downloads. As such, base64-min popularity was classified as popular.
We found that base64-min 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.