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

short-host

v0.1.1

Published

Represent any IPv4 based host like `A.B.C.D:P` as a short sequence of 1 to 10 chars

Downloads

10

Readme

short-host

Represent any IPv4 based host like A.B.C.D:P as a short sequence of 1 to 10 chars:

  • A, B, C and D are IPv4 numbers from 0 to 255
  • P is a network port number from 0 to 65535
  • Generated chars are lowercase letters or numbers (only 2, 3, 4, 5, 6 or 7)

Examples

  • 192.168.0.15:8080 => p
  • 192.168.0.27:8080 => bw
  • 192.168.1.182:5173 => 3n
  • 192.168.0.27:4200 => bwd
  • 192.168.1.85:3000 => vkc
  • 192.168.1.111:443 => w6os
  • 192.168.27.81:4444 => dniqr
  • 192.168.27.81:7812 => dnixuq
  • 4.15.167.243:8080 => aqh2p4y
  • 4.15.167.243:123 => aqh2p44s
  • 4.15.167.243:2345 => aqh2p42j6
  • 4.15.167.243:56789 => aqh2p4zxov

Why?

  1. I wanted to have fun with a silly idea
  2. I sometimes need to browse a local dev server on another device of my local network but it's very annoying to type the IP address and the port

How to use?

  • Use the bookmarklet below to generate the short host code from device A
  • Add this bookmark to browse the short host on device B

bookmarklet:

javascript:(function()%7Bvar%20url%20%3D%20new%20URL('https%3A%2F%2Fhsablonniere.github.io%2Fshort-host')%3B%0Aurl.searchParams.set('host'%2C%20location.host)%3B%0Alocation.href%20%3D%20url.toString()%3B%7D)()%3B

npm library

You can use this in your projects to display short hosts.

Installation

npm install short-host

JavaScript usage

import { toShortHost, fromShortHost } from 'short-host';

console.log(toShortHost('192.168.0.27:8080'));
// => "bw"

console.log(fromShortHost('bw'));
// => "192.168.0.27:8080"

Details

The main goals and constraints were:

  • Focus on local IPs starting with 192.168, especially 192.168.0 and 192.168.1.
  • Favor HTTP ports often used in local dev like 8080, 5173 or 3000
  • Be able to represent any IPv4 and port

You can have a look at IMPLEMENTATION_DETAILS.md to learn how the encoding/decoding works.