Skip to content
/ b64-cjs Public

A library to encode to and decode from base64, similar to atob btoa of native JavaScript functions.

License

Notifications You must be signed in to change notification settings

grjan7/b64-cjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

b64-cjs

NPM version NPM downloads Known Vulnerabilities

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));

About

A library to encode to and decode from base64, similar to atob btoa of native JavaScript functions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published