New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

b2a

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

b2a

btoa and atob (ie base64 encoding and decoding) support for node.js or old browsers, with the Unicode Problems fixed

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.9K
decreased by-10.5%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage

b2a

btoa and atob (base64 encoding and decoding) support for node.js or old browsers, with the Unicode Problems fixed.

This module will try to reuse window.atob and window.btoa when possible.

Install

$ npm install b2a

Usage

import {
  atob,
  btoa
} from 'b2a'

btoa('a')          // 'YQ=='
window.btoa('a')   // 'YQ==', works fine with ASCII characters


// Oooooooops!
// In most browsers, calling btoa() on a Unicode string will cause a Character Out Of Range exception.
window.btoa('中文')   // throws InvalidCharacterError

btoa('中文')          // '5Lit5paH'


// Oooooooops!
window.atob('5Lit5paH')      // '中æ', oh no!

atob('5Lit5paH')             // '中文', great!

License

MIT

Keywords

FAQs

Package last updated on 08 Sep 2017

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