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

1.0.0 • Public • Published

python compatible urlsafe base 64 codec

Similar to urlsafe-base64 this library de-/encodes urlsafe base64 strings.

What it does different:

  • Offers a safe and short variant with the short variant being same as urlsafe-base64 and the safe variant keeping the ending = characters making it compatible with other implementations such as python.
  • Comes with typescript definitions.
  • Uses Buffer.from as new Buffer has been deprecated for a long time.

Usage

import { short, safe } from '@tradle/urlsafe-base64'

;[ short, safe ].forEach(variant => {
  const base64Str = short.encode('hello')

  const decoded = short.decode(base64Str)
  const original = decoded.toString()
})

License

MIT

Package Sidebar

Install

npm i @tradle/urlsafe-base64

Weekly Downloads

19

Version

1.0.0

License

MIT

Unpacked Size

6.76 kB

Total Files

12

Last publish

Collaborators

  • spwilko
  • leichtgewicht
  • genevayngrib
  • tenaciousmv
  • pgmemk