1.0.2 • Published 4 years ago

web-base64 v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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)