b64-cjs
v1.0.2
Published
A cjs library to encode to and decode from base64 charset.
Downloads
4
Maintainers
Readme
b64-cjs
A library to encode to and decode from base64, similar to atob btoa of native JavaScript functions.
Installation
$ npm install b64-cjs
base64.encode(plainStr)
const Base64 = require('b64-cjs');
const myObj = {name: "john", age: 30};
const myObjString = JSON.stringify(myObj);
const base64EncodedString = Base64.encode(myObjString);
console.log(base64EncodedString);
base64.decode(base64Str)
const Base64 = require('b64-cjs');
const myObj = {name: "john", age: 30};
const myObjString = JSON.stringify(myObj);
const base64EncodedString = Base64.encode(myObjString);
const decodedBase64String = Base64.decode(base64EncodedMyObj);
console.log(JSON.parse(decodedBase64String));