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

@vandeurenglenn/base-x

v1.2.1

Published

Fast, optimized, and compatible base-x encoding/decoding library.

Readme

@vandeurenglenn/base-x

Fast, optimized, and compatible base-x encoding/decoding library.

This library is a high-performance drop-in replacement for the standard base-x library. It includes transparent optimizations for power-of-2 bases (Base16, Base32, Base64), achieving 5x-7x faster performance while maintaining full backward compatibility.

It also introduces optional RFC 4648 compliance for standard Hex, Base32, and Base64 implementations.

Install

npm i -S @vandeurenglenn/base-x

Features

  • High Performance: Automatically switches to a customized bitwise algorithm for bases that are powers of 2 (16, 32, 64), offering significant speedups over generic integer arithmetic.
  • Backwards Compatible: By default, it mimics the behavior of the original base-x library (integer-based encoding, preserving leading zero characters), making it safe for use in cryptocurrency applications (e.g., Bitcoin Base58).
  • RFC 4648 Support: Optional mode to strictly follow RFC standards (padding, 8-bit block alignment) for standard web/network use cases.
  • TypeScript: First-class TypeScript support with included type definitions.

Usage

Standard Mode (Drop-in Replacement)

Behaves exactly like base-x. Note: This mode follows the "Bitcoin-style" integer encoding (leading zero preservation, no padding).

import base from '@vandeurenglenn/base-x'

const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
const bs58 = base(BASE58)

const data = new Uint8Array([0, 255])
const encoded = bs58.encode(data)
console.log(encoded) // "1LU" (1 preserves the leading zero byte)

const decoded = bs58.decode(encoded)
console.log(decoded) // Uint8Array [0, 255]

RFC 4648 Mode (Standard Base64/Hex/Base32)

Enable this mode if you need standard padding (=) and strict behavior matching built-in browser/Node.js methods.

import base from '@vandeurenglenn/base-x'

const BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
// Enable RFC 4648 compliance
const b64 = base(BASE64, { rfc4648: true })

const data = new TextEncoder().encode('Hello World')

// Encodes with padding
const encoded = b64.encode(data)
console.log(encoded) // "SGVsbG8gV29ybGQ="

// Decodes standard Base64 string
const decoded = b64.decode(encoded)
console.log(new TextDecoder().decode(decoded)) // "Hello World"

Performance

Benchmarks run on Node.js v25:

| Algorithm | @vandeurenglenn/base-x | standard base-x | Speedup | |-----------|------------------------|-----------------|---------| | Base16| ~3,400,000 ops/sec | ~516,000 ops/sec| ~6.5x| | Base32| ~4,100,000 ops/sec | ~680,000 ops/sec| ~6.0x| | Base64| ~4,900,000 ops/sec | ~878,000 ops/sec| ~5.5x| | Base58| ~600,000 ops/sec | ~594,000 ops/sec| ~1.0x |

License

MIT © base-x contributors & Vandeuren Glenn