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

@pipobscure/base32

v0.1.0

Published

Base32 Encodeing/Decoding

Downloads

9

Readme

📦 @pipobscure/base32 — Simple TypeScript Base32 Encoder/Decoder

A lightweight, dependency-free Base32 encoder/decoder implemented in TypeScript with support for both synchronous and asynchronous streaming.

✨ Features

  • 🔢 Encode and decode Base32 strings
  • ⚙️ Works directly with Uint8Array
  • 🚀 Synchronous and asynchronous streaming support
  • 🪶 Zero dependencies
  • 🧩 Fully typed for TypeScript
  • 🧠 Works in both Node.js and browser environments

🧰 Usage

Basic Encoding & Decoding

import { encode, decode } from "@pipobscure/base32";

const data = new TextEncoder().encode("Hello world!");

// Encode to Base32
const encoded = encode(data);
console.log(encoded);
// → "nbswy3dpeb3w64tmmq"

// Decode back to bytes
const decoded = decode(encoded);
console.log(new TextDecoder().decode(decoded));
// → "Hello world!"

Streaming (Synchronous)

import { encodeIterable, decodeIterable } from "@pipobscure/base32";

const chunks = [
  new TextEncoder().encode("Hello "),
  new TextEncoder().encode("world!")
];

// Encode in chunks
const encodedChunks = Array.from(encodeIterable(chunks)).join("");
console.log(encodedChunks);

// Decode in chunks
const decodedChunks = Array.from(decodeIterable([encodedChunks]));
const decodedData = Uint8Array.from(decodedChunks.flat());
console.log(new TextDecoder().decode(decodedData));

Asynchronous Streaming

For large or lazy data sources like network responses or file streams, you can use async generators.

import { encodeAsyncIterable, decodeAsyncIterable } from "@pipobscure/base32";

async function* readChunks() {
  yield new TextEncoder().encode("Hello ");
  await new Promise(r => setTimeout(r, 10)); // simulate async source
  yield new TextEncoder().encode("world!");
}

// Encode asynchronously
let encoded = "";
for await (const part of encodeAsyncIterable(readChunks())) {
  encoded += part;
}
console.log(encoded);

// Decode asynchronously
let decoded = new Uint8Array();
for await (const chunk of decodeAsyncIterable([encoded])) {
  decoded = new Uint8Array([...decoded, ...chunk]);
}
console.log(new TextDecoder().decode(decoded));
// → "Hello world!"

⚙️ API Reference

encode(data: Uint8Array): string

Encodes a Uint8Array into a Base32 string.

decode(data: string): Uint8Array

Decodes a Base32 string into a Uint8Array.

encodeIterable(chunks: Iterable<Uint8Array>): Iterable<string>

Encodes data from a synchronous iterable source into Base32 segments.
Ideal for processing static data in chunks.

decodeIterable(parts: Iterable<string>): Iterable<Uint8Array>

Decodes Base32 segments from a synchronous iterable source.

encodeAsyncIterable(chunks: AsyncIterable<Uint8Array>): AsyncIterable<string>

Encodes data from an asynchronous iterable source into Base32-encoded chunks.
Perfect for file streams, network data, or any async producer.

decodeAsyncIterable(parts: AsyncIterable<string>): AsyncIterable<Uint8Array>

Decodes Base32 data from an asynchronous iterable source into decoded byte chunks.

🧑‍💻 TypeScript Support

Written entirely in TypeScript with comprehensive type definitions—no need for extra @types packages.

📄 License

EUPL v1.2 © 2025 Philipp Dunkel [email protected]