New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

b64-cjs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

b64-cjs

A cjs library to encode to and decode from base64 charset.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

base64

FAQs

Package last updated on 08 Jan 2023

Did you know?

Socket

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.

Install

Related posts