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 🙏

© 2024 – Pkg Stats / Ryan Hefner

base92

v3.2.1

Published

Base92 (9 kB)

Downloads

21

Readme

Base92+64 JavaScript Encoder and Decoder

GREAT = Base92, GOOD = Base64;

SMART AS MORE OVER 92:64

Probably THE ONLY PURE-JS BASE92 (2023) encoding/decoding system in javascript, most notably also faster than half of the st*pid base64 encoding/decoding library (it re-use the memory system and is written in low-level javascript in order to make the engine work based on lighter dataset and operations)

While Gzip (used in most web servers nowadays) is well suited for Base64, it doesn't lose any key (compression) performance based on Base92, but the greatest of "it all" is that, IT SHOULD ALWAYS HAVE BEEN BASE92 IN JSON AND SUCH BECAUSE IT CAN BE EASILY (The lazy situp-wordu of many companies are just operator not architect)


GREAT IS THE ENEMY OF GOOD


The Base92 JavaScript module provides methods to encode and decode data using a base92+64 encoding scheme. It is not faster than base64 but it provides a more space-efficient result in UTF-8 or UTF-16 source code strings, making it useful for all kinds of inline data in source code.

The module is minified and has a footprint of just 14 kB, and requires no dependencies. This makes it an easy and lightweight solution for your encoding needs.

Installation

Since this module is provided as an npm package, you can install it using npm:

npm install base92

Usage

Import the module into your JavaScript code:

var BaseN = require('base92');
var Base92 = BaseN.Base92;
var Base64 = BaseN.Base64;

Import the minified file into your JavaScript code:

 // <script> 'index.min.js';
var Base92 = window.Base92;

Encoding

To encode data, create an instance of the Base92 class and use the encode method. This method takes a Uint8Array` as input:

var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
var base92 = new Base92();

// You have to tell if you want to have a new Uint8Array because... Wait!
// If you don't the system will reuse the memory system of the instanciated class' JS object, OK?!
// Optional, WILL trigger a copy (if set to true) of the internal (memory) storage system...
var slice = false; // This variable' parameter's (secondary) position is not mandatory
// Just to know, if you don't get a copy and do encoding operation twice, you might have the same Uint8Array twice

var encodedData92 = base92.encode(data, slice); // "  ,@%7 sBv&]1"
console.log(encodedData92);

Decoding

To decode data, use the decode method of the Base92` class instance. This method takes a string as input:

var decodedData92 = base92.decode(encodedData92);
console.log(decodedData92);

License (before)

THE BEERWARE LICENSE (Revision 42):

License (now)

COPYLEFT