Socket
Socket
Sign inDemoInstall

base64-transcoder

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

base64-transcoder

Base64 transcoding in pure JS


Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

base64-transcoder

Base64 transcoding in pure JS. Forked from base64-js. Note that for compatibility with node, this module's default alphabet will decode base64 AND base64-url.

Methods

Three methods are exposed: encode, decode and byteLength. Each requires a single argument, encode and decode also accept an optional alphabet argument (see alphabets property below).

encode

Takes a byte array and returns a base64 string.

decode

Takes a base64 string and returns a byte array.

byteLength

Takes a base64 string and returns length of byte array.

Properties

alphabets

Use this property to do base64 transcoding with arbitrary alphabets. For example it is possible to implement base64-url using this interface:

b64.alphabets.url = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
var a = b64.toByteArray('aa+/')
var b = b64.fromByteArray(a, 'url')
console.log(b === 'aa-_') // true

Prior art

https://github.com/beatgammit/base64-js

License

MIT

FAQs

Package last updated on 04 May 2022

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc