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

@hexagon/base64-arraybuffer

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

@hexagon/base64-arraybuffer

Encode/decode base64 and base64url data into ArrayBuffers

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@hexagon/base64-arraybuffer

CI NPM Downloads NPM Version

Encode/decode base64 or base64url data into ArrayBuffers.

This is basically github.com/niklasvh/base64-arraybuffer, but with added base64url support.

Installing

Node

You can install the module via npm:

npm install @hexagon/base64-arraybuffer

const base64 = require('@hexagon/base64-arraybuffer');

const result = base64.encode("Hello World!");
const resultUrl = base64.encode("Hello World!", true);
CDN / Browser / Deno

www.jsdelivr.com/package/npm/@hexagon/base64-arraybuffer?path=dist

In a browser, you normally want /dist/base64-arraybuffer.umd.js which will register a global object named base64

// Global object base64 available

const result = base64.encode("Hello World!");
const resultUrl = base64.encode("Hello World!", true);

API

The library encodes and decodes base64/base64url to and from ArrayBuffers

  • encode(buffer) - Encodes ArrayBuffer into base64 string

  • decode(str) - Decodes base64 string to ArrayBuffer

  • encode(buffer, true) - Encodes ArrayBuffer into base64url string

  • decode(str, true) - Decodes base64url string to ArrayBuffer

Testing

You can run the test suite with:

npm test

License

Copyright (c) 2021 Hexagon Licensed under the MIT license.

Copyright (c) 2012 Niklas von Hertzen Licensed under the MIT license.

FAQs

Package last updated on 07 Dec 2021

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