qwtel / web-base64

Slightly modernized version of base64-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTE: This is now part of the enhanced base64-encoding module.

Web Base64

Slightly modernized version of base64-js.

Main difference is the option to generate URL-friendly Base64, where

  • + => -,
  • / => _ and
  • = => ~ (these are unreserved URI characters according to RFC 3986)

This version also drops support for platforms that don't provide Uint8Array and DataView.

API has slightly changed and now expects an ArrayBuffer instead of an Uint8Array, whcih makes it easier to use with other typed arrays and without the need for additional copying.

Usage

const mobyDick = await fs.promises.readFile(path.resolve('test/mobydick.txt'));
const b64String = fromByteArray(mobyDick.buffer)

About

Slightly modernized version of base64-js

License:MIT License


Languages

Language:JavaScript 100.0%