npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kakilangit/base64

v0.2.0

Published

WebAssembly bindings for Base64 Encoder/Decoder tool

Readme

@kakilangit/base64

WebAssembly bindings for Base64 Encoder/Decoder tool.

Overview

This package provides fast Base64 encoding and decoding functionality compiled to WebAssembly from Rust. It supports both standard Base64 and URL-safe Base64 alphabets, with optional padding.

Installation

npm install @kakilangit/base64

Usage

import init, { encode_base64, decode_base64, Base64Alphabet } from '@kakilangit/base64';

// Initialize the WASM module
await init();

// Encode with standard alphabet and padding
const encoded = encode_base64("Hello, World!", Base64Alphabet.Standard, true);
console.log(encoded.encoded); // "SGVsbG8sIFdvcmxkIQ=="

// Encode with URL-safe alphabet (no padding)
const urlSafe = encode_base64("Hello+World=/", Base64Alphabet.UrlSafe, false);

// Decode
const decoded = decode_base64("SGVsbG8sIFdvcmxkIQ==", Base64Alphabet.Standard);
console.log(decoded.decoded); // "Hello, World!"
console.log(decoded.is_valid); // true

API

Functions

encode_base64(input, alphabet, pad)

Encodes a string to Base64.

  • input (string): The string to encode
  • alphabet (Base64Alphabet): The alphabet to use
  • pad (boolean): Whether to add padding characters

Returns EncodeResult:

  • original: Original input string
  • encoded: Encoded Base64 string
  • alphabet: Alphabet name used
  • padded: Whether padding was added
  • byte_count: Length of input in bytes

decode_base64(input, alphabet)

Decodes a Base64 string.

  • input (string): The Base64 string to decode
  • alphabet (Base64Alphabet): The alphabet to use

Returns DecodeResult:

  • original: Original Base64 input
  • decoded: Decoded string
  • is_valid: Whether the input was valid Base64
  • byte_count: Length of decoded output in bytes
  • alphabet: Alphabet name detected/used

Convenience Functions

  • encode_base64_standard(input, pad) - Encode using standard alphabet
  • encode_base64_url_safe(input, pad) - Encode using URL-safe alphabet
  • decode_base64_standard(input) - Decode using standard alphabet
  • decode_base64_url_safe(input) - Decode using URL-safe alphabet

Enums

Base64Alphabet

  • Standard = 0 - Standard Base64 alphabet (A-Z, a-z, 0-9, +, /)
  • UrlSafe = 1 - URL-safe Base64 alphabet (A-Z, a-z, 0-9, -, _)

Features

  • Fast Base64 encoding/decoding via WebAssembly
  • Standard RFC 4648 Base64 alphabet support
  • URL-safe Base64 alphabet (RFC 4648 section 5)
  • Optional padding control
  • Input validation with detailed error messages

License

MIT