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

6bit-encoder

v0.2.0

Published

Encodes 6bit numbers (0..63) to URL safe chars.

Downloads

13

Readme

6bit-encoder build status

Encodes 6bit numbers (0..63) to URL safe chars.

const assert = require('assert')
const { encode, encode5, decode, decode5 } = require('6bit-encoder')

assert.equal(encode(0b001111), 'F')
assert.equal(encode5(0b011111011111011111011111011111), 'VVVVV')
assert.equal(decode('F'), 0b001111)
assert.equal(decode5('VVVVV'), 0b011111011111011111011111011111)

Installation

npm install 6bit-encoder

Table of Contents generated with DocToc

API

SEPARATOR

A URL safe char that is not part of the encoding table and can be used as a separator: '*'

Type: String

SEPARATORS

Remaining URL safe chars that are not part of the encoding table and can be used as a separator: ; , . ~ ( ' ) ! * : @

Type: Array<String>

decode

Decodes one char into a 6 bit number

Parameters

Returns Number a 6 bit number

decode2

Decodes two chars into a 12 bit number

Parameters

Returns Number a 12 bit number

decode3

Decodes three chars into an 18 bit number

Parameters

Returns Number an 18 bit number

decode4

Decodes four chars into an 24 bit number

Parameters

Returns Number a 24 bit number

decode5

Decodes five chars into an 30 bit number

Parameters

Returns Number a 30 bit number

encode

Encodes a 6 bit number into a URL safe char

Parameters

Returns String the char

encode2

Encodes a 12 bit number into two URL safe chars

Parameters

Returns String the chars

encode3

Encodes a 18 bit number into three URL safe chars

Parameters

Returns String the chars

encode4

Encodes a 24 bit number into four URL safe chars

Parameters

Returns String the chars

encode5

Encodes a 30 bit number into five URL safe chars

Parameters

Returns String the chars

decodeFor

Get a decode function to decode n chars

Parameters

  • n Number the number of chars to decode

Returns function the matching decoding function

encodeFor

Get an encode function to encode an n * 6 bit number

Parameters

  • n Number number of 6 bits to encode

Returns function the matching encoding function

License

MIT