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

@waiting/base64

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waiting/base64

Base64 encoding/decoding in pure JS on both modern Browsers and Node.js

  • 4.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
171
decreased by-28.75%
Maintainers
1
Weekly downloads
 
Created
Source

Base64

Base64 encoding/decoding in pure JS on both modern Browsers and Node.js based on base64-js

Version License Build Status Build status Coverage Status

Features

  • Encoding input supports typeof string, number and bigint
  • Encoding input supports ArrayBuffer or Uint8Array
  • Encoding/Decoding via TextEncoder/TextDecoder under browser and Buffer under Node.js

Browser requirement

Node.js requirement

  • v10.4.0+ for bigint base64 encoding
  • ICU installation for base64 decoding with encodeings other then utf-8 and utf-16le

Installing

npm install @waiting/base64

Usage

Encodeing

import { b64encode, b64fromBuffer } from '@waiting/base64'

b64encode('A') === 'QQ=='
b64encode('𠮷') === b64encode('\uD842\uDFB7') === b64encode('\u{20BB7}') // '8KCutw=='
b64encode('schöne') === 'c2Now7ZuZQ=='
// bigint
b64encode(1n) === b64encode(1) // 'MQ=='

const u8arr = Uint8Array.from([0xe4, 0xb8, 0xad, 0xe6, 0x96, 0x87])
b64fromBuffer(u8arr) === b64encode('中文')  // '5Lit5paH'

Decoding

import { b64decode } from '@waiting/base64'

b64decode('MQ==') === '1'

Testing

npm run test

# for browsers FireFox and Chrome
npm run test:browser

# for browsers all available on this client
cd .config && npm i
npm run browser:detect

Demos

License

MIT

Languages

Keywords

FAQs

Package last updated on 12 Jun 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