Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

base64-binary

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base64-binary

A polyfill built upon atob/btoa (browser side only) so as to support base64 to/from binary (Uint8Array/ArrayBuffer) conversion

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
increased by177.78%
Maintainers
1
Weekly downloads
 
Created
Source

base64-binary

A polyfill built upon atob/btoa (browser) so as to support base64 to/from binary (Uint8Array/ArrayBuffer) conversion

Motivation

It seems that the built-in atob and btoa functions don't support encoding binary (Uint8Array or ArrayBuffer) to base64 string and decoding base64 string to binary directly. However, with the help of this polyfill which adds a thin layer to make extra conversion between String and Uint8Array, we can make it by standing on the shoulders of giants.

Usage

Add reference in your HTML file

...
<script type="text/javascript" src="/path/to/base64-lite.js"></script>
...

Now you can make base64 codec for binary data

const bin = base64.decode("hzw4NdSJ0NzaEKo9hSKiH+X5ViFAh+hmYDuorCqDjEk=");
console.log(base64.encode(bin));

Dependencies

Browser with ES5 support

License

Written in 2019 by tibetty xihua.duan@gmail.com

Keywords

FAQs

Package last updated on 03 Jul 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc