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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pixagram/turbobase64

v0.0.2

Published

Ultra-optimized JavaScript base64. SIMD optimization.

Downloads

54

Readme

@pixagram/turbobase64

A high-performance JavaScript implementation of Base64 encoding and decoding, inspired by the SIMD-accelerated C library, TurboBase64. This module is designed for speed, processing data in large chunks to optimize performance.

Features

  • High-Speed Encoding & Decoding: Optimized for performance by processing data in large blocks.

  • Pure JavaScript: No native dependencies, runs in Node.js and modern browsers.

  • Uint8Array Support: Works directly with Uint8Array for efficient binary data handling.

  • Inspired by TurboBase64: Aims to bring the performance philosophy of the original C library to the JavaScript ecosystem.

Installation

Install the package using npm:

npm install @pixagram/turbobase64

Usage

Here's a quick example of how to use the TurboBase64 class to encode and decode data.

import TurboBase64 from '@pixagram/turbobase64';

// Or if you are using CommonJS:
// const TurboBase64 = require('@pixagram/turbobase64');

const turboB64 = new TurboBase64();

// --- Encoding ---
const originalString = "Fast and efficient Base64 encoding!";
const textEncoder = new TextEncoder();
const originalData = textEncoder.encode(originalString);

const encodedString = turboB64.encode(originalData);
console.log("Encoded:", encodedString);
// Output: "RmFzdCBhbmQgZWZmaWNpZW50IEJhc2U2NCBlbmNvZGluZyE="

// --- Decoding ---
const decodedData = turboB64.decode(encodedString);
const textDecoder = new TextDecoder();
const decodedString = textDecoder.decode(decodedData);

console.log("Decoded:", decodedString);
// Output: "Fast and efficient Base64 encoding!"

console.log("Match:", originalString === decodedString);
// Output: true

How It Works

This library's performance comes from its strategy of processing data in large, fixed-size chunks (12 bytes for encoding, 16 bytes for decoding). While the original C library relies on SSE/AVX intrinsics for maximum speed, this JavaScript version uses highly optimized scalar operations on these chunks. This approach avoids the overhead of processing byte-by-byte, resulting in a significant speed advantage for large data sets compared to more traditional Base64 implementations in JavaScript.

A simd.js polyfill is included for compatibility, but the core transformation logic relies on proven scalar bitwise operations for correctness and reliability across all JavaScript environments.

API

new TurboBase64()

Creates a new TurboBase64 instance. The constructor initializes the necessary lookup tables for encoding and decoding.

turboB64.encode(input)

  • input: Uint8Array - The binary data to encode.

  • Returns: string - The Base64 encoded string.

turboB64.decode(input)

  • input: string - The Base64 encoded string.

  • Returns: Uint8Array - The decoded binary data.

License

The original C source code for TurboBase64 is licensed under the GPL v3 License. This JavaScript adaptation is also released under the GPL v3 License.