npm.io
1.0.2 • Published 6 years ago

web-base64

Licence
MIT
Version
1.0.2
Deps
0
Size
14 kB
Vulns
0
Weekly
0

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)