![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
6bit-encoder
Advanced tools
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)
npm install 6bit-encoder
Table of Contents generated with DocToc
A URL safe char that is not part of the encoding table and
can be used as a separator: '*'
Type: String
Remaining URL safe chars that are not part of the encoding table and
can be used as a separator: ; , . ~ ( ' ) ! * : @
Decodes one char into a 6 bit number
Parameters
s
String the char to decodeReturns Number a 6 bit number
Decodes two chars into a 12 bit number
Parameters
s
String the chars to decodeReturns Number a 12 bit number
Decodes three chars into an 18 bit number
Parameters
s
String the chars to decodeReturns Number an 18 bit number
Decodes four chars into an 24 bit number
Parameters
s
String the chars to decodeReturns Number a 24 bit number
Decodes five chars into an 30 bit number
Parameters
s
String the chars to decodeReturns Number a 30 bit number
Encodes a 6 bit number into a URL safe char
Parameters
n
Number a 6 bit numberReturns String the char
Encodes a 12 bit number into two URL safe chars
Parameters
n
Number a 12 bit numberReturns String the chars
Encodes a 18 bit number into three URL safe chars
Parameters
n
Number a 18 bit numberReturns String the chars
Encodes a 24 bit number into four URL safe chars
Parameters
n
Number a 24 bit numberReturns String the chars
Encodes a 30 bit number into five URL safe chars
Parameters
n
Number a 30 bit numberReturns String the chars
Get a decode function to decode n chars
Parameters
n
Number the number of chars to decodeReturns function the matching decoding function
Get an encode function to encode an n * 6
bit number
Parameters
n
Number number of 6 bits to encodeReturns function the matching encoding function
MIT
FAQs
Encodes 6bit numbers (0..63) to URL safe chars.
The npm package 6bit-encoder receives a total of 1 weekly downloads. As such, 6bit-encoder popularity was classified as not popular.
We found that 6bit-encoder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.