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

short64

v1.0.1

Published

Shorter base64 encoding for integers

Readme

short64 : Shorter base64 encoding for integers

short64 facilitates encoding and decoding integers as shorter as possible strings.

Works on browsers and nodeJS.

Installation

Install from NPM

npm i short64

Usage - with ES6 modules

import short64 from "short64";

let inputInt = 123;
let short64string = short64.From(inputInt);
let decodedInt = short64.ToInt(short64string);

console.log({
  inputInt,
  short64string,
  decodedInt,
});

Output

{inputInt: 123, short64string: 'B7', decodedInt: 123}

Usage - with common JS

Access the default property of the module.

let short64 = require("short64").default;

let inputInt = 123;
let short64string = short64.From(inputInt);
let decodedInt = short64.ToInt(short64string);

console.log({
  inputInt,
  short64string,
  decodedInt,
});

Output

{inputInt: 123, short64string: 'B7', decodedInt: 123}

Usage - custom alphabet

import short64 from "short64";

short64.SetAlphabet(
  "A~CDEFGHIJKLMNOPQRSTUVWXYZ$%^&efghijklmnopqrstuvwxyz0987654321*#"
);

let inputInt = 123;
let short64string = short64.From(inputInt);
let decodedInt = short64.ToInt(short64string);

console.log({
  inputInt,
  short64string,
  decodedInt,
});

Output :

{inputInt: 123, short64string: '~3', decodedInt: 123}

Default alphabet is

SetAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-");

Base64 friendly alphabet is

SetAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");

Sample outputs

| Input integer | digits | short64 | short64 length | base64 (btoa) | base64 length | | ---------------- | ------ | --------------- | -------------- | -------------------------- | ------------- | | 0 | 1 | 'A' | 1 | 'MA==' | 4 | | 1 | 1 | 'B' | 1 | 'MQ==' | 4 | | 9 | 1 | 'J' | 1 | 'OQ==' | 4 | | 44 | 2 | 's' | 1 | 'NDQ=' | 4 | | 100 | 3 | 'Bk' | 2 | 'MTAw' | 4 | | 2000 | 4 | 'fQ' | 2 | 'MjAwMA==' | 8 | | 3135 | 4 | 'w-' | 2 | 'MzEzNQ==' | 8 | | 4095 | 4 | '--' | 2 | 'NDA5NQ==' | 8 | | 153663 | 6 | 'lg-' | 3 | 'MTUzNjYz' | 8 | | 262143 | 6 | '---' | 3 | 'MjYyMTQz' | 8 | | 7529535 | 7 | 'cuQ-' | 4 | 'NzUyOTUzNQ==' | 12 | | 16777215 | 8 | '----' | 4 | 'MTY3NzcyMTU=' | 12 | | 368947263 | 9 | 'V-bA-' | 5 | 'MzY4OTQ3MjYz' | 12 | | 1073741823 | 10 | '-----' | 5 | 'MTA3Mzc0MTgyMw==' | 16 | | 18078415935 | 11 | 'Q1jrw-' | 6 | 'MTgwNzg0MTU5MzU=' | 16 | | 68719476735 | 11 | '------' | 6 | 'Njg3MTk0NzY3MzU=' | 16 | | 885842380863 | 12 | 'M5AUgg-' | 7 | 'ODg1ODQyMzgwODYz' | 16 | | 4398046511103 | 13 | '-------' | 7 | 'NDM5ODA0NjUxMTEwMw==' | 20 | | 9007199254740991 | 16 | 'f--------' | 9 | 'OTAwNzE5OTI1NDc0MDk5MQ==' | 24 |