@hazae41/base64url
TypeScript icon, indicating that this package has built-in type declarations

1.0.17 • Public • Published

Base64Url

Base64Url adapter for WebAssembly and JS implementations

npm i @hazae41/base64url

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies

Getting started

Buffer (NodeJS)

import { Base64Url } from "@hazae41/base64url"

Base64Url.set(Base64Url.fromBuffer())

WebAssembly

npm i @hazae41/base64.wasm"
import { Base64Url } from "@hazae41/base64url"
import { Base64Wasm } from "@hazae41/base64.wasm"

await Base64Wasm.initBundled()

Base64Url.set(Base64Url.fromBufferOrWasm(Base64Wasm))

Scure (JavaScript)

npm i @scure/base
import { Base64Url } from "@hazae41/base64url"
import * as Scure from "@scure/base"

Base64Url.set(Base64Url.fromBufferOrScure(Scure))

Usage

const encoded: string = Base64Url.get().getOrThrow().encodeUnpaddeOrThrow(new Uint8Array([1,2,3,4,5]))
using decoded: Copiable = Base64Url.get().getOrThrow().decodeUnpaddedOrThrow(encoded)
const decoded2: Uint8Array = decoded.bytes.slice()

Package Sidebar

Install

npm i @hazae41/base64url

Weekly Downloads

42

Version

1.0.17

License

MIT

Unpacked Size

89.1 kB

Total Files

49

Last publish

Collaborators

  • hazae41