This package has been deprecated

Author message:

This package is no longer supported, use @hexagon/base64 instead

@hexagon/base64-arraybuffer
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

@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.

Dependencies (0)

    Dev Dependencies (17)

    Package Sidebar

    Install

    npm i @hexagon/base64-arraybuffer

    Weekly Downloads

    0

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    23.5 kB

    Total Files

    12

    Last publish

    Collaborators

    • hexagon