All Projects â†’ base62 â†’ Base62.js

base62 / Base62.js

Licence: mit
🔡 A javascript Base62 encode/decoder for node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Base62.js

Base62
PHP Base62 encoder and decoder for integers and big integers with Laravel 5 support.
Stars: ✭ 16 (-85.19%)
Mutual labels:  encoding, decoder
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (-65.74%)
Mutual labels:  encoding, decoder
Sdp
RFC 4566 SDP implementation in go
Stars: ✭ 109 (+0.93%)
Mutual labels:  encoding, decoder
AnimatedGif
📼 A high performance .NET library for reading and creating animated GIFs
Stars: ✭ 106 (-1.85%)
Mutual labels:  encoding, decoder
Jconv
Pure-JavaScript converter for Japanese character encodings.
Stars: ✭ 91 (-15.74%)
Mutual labels:  encoding
Faad2
Freeware Advanced Audio (AAC) Decoder faad2 mirror
Stars: ✭ 82 (-24.07%)
Mutual labels:  decoder
Bitmatch
A Rust crate that allows you to match, bind, and pack the individual bits of integers.
Stars: ✭ 82 (-24.07%)
Mutual labels:  encoding
Decoder Plus Plus
An extensible application for penetration testers and software developers to decode/encode data into various formats.
Stars: ✭ 79 (-26.85%)
Mutual labels:  decoder
Vp8 Webm Javascript Decoder
hand ported version of vp8 webm javascript decoder
Stars: ✭ 101 (-6.48%)
Mutual labels:  decoder
Msgpack
msgpack.org[Go] MessagePack encoding for Golang
Stars: ✭ 1,353 (+1152.78%)
Mutual labels:  encoding
Encoding Wrapper
Collection of Go wrappers for Video encoding cloud providers (moved to @video-dev)
Stars: ✭ 90 (-16.67%)
Mutual labels:  encoding
Vvdec
Fraunhofer Versatile Video Decoder (VVdeC)
Stars: ✭ 84 (-22.22%)
Mutual labels:  decoder
Wx Voice
Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general formats such as MP3 and M4A
Stars: ✭ 93 (-13.89%)
Mutual labels:  decoder
Irext
Universal IR Remote Control Solution
Stars: ✭ 1,240 (+1048.15%)
Mutual labels:  encoding
Gifdec
small C GIF decoder
Stars: ✭ 100 (-7.41%)
Mutual labels:  decoder
Torch Encoding Layer
Deep Texture Encoding Network
Stars: ✭ 80 (-25.93%)
Mutual labels:  encoding
Niutrans.smt
NiuTrans.SMT is an open-source statistical machine translation system developed by a joint team from NLP Lab. at Northeastern University and the NiuTrans Team. The NiuTrans system is fully developed in C++ language. So it runs fast and uses less memory. Currently it supports phrase-based, hierarchical phrase-based and syntax-based (string-to-tree, tree-to-string and tree-to-tree) models for research-oriented studies.
Stars: ✭ 90 (-16.67%)
Mutual labels:  decoder
Rlp
Recursive Length Prefix Encoding in JavaScript
Stars: ✭ 93 (-13.89%)
Mutual labels:  encoding
Opusfile
Stand-alone decoder library for .opus streams
Stars: ✭ 86 (-20.37%)
Mutual labels:  decoder
Binary
Generic and fast binary serializer for Go
Stars: ✭ 86 (-20.37%)
Mutual labels:  encoding

Base62.js

build status npm version devDependency Status Gitter chat

A JavaScript Base62 encode/decoder

What is Base62 encoding?

Base62 encoding converts numbers to ASCII strings (0-9, a-z and A-Z) and vice versa, which typically results in comparatively short strings. Such identifiers also tend to more readily identifiable by humans.

  • 999 ≙ "g7"
  • 9999 ≙ "2Bh"
  • 238327 ≙ "ZZZ"

Installation

npm install base62

alternatively using Yarn:

yarn add base62

Usage

For backwards compatibility, Base62.js exposes v1.x's API by default – see Legacy API below. For efficiency, v2.x's modernized API allows selectively importing individual modules instead:

var base62 = require("base62/lib/ascii");

base62.encode(999);  // "g7"
base62.decode("g7"); // 999

This uses the default ASCII character set for encoding/decoding.

It's also possible to define a custom character set instead:

var base62 = require("base62/lib/custom");

var charset = "~9876543210ABCDEFGHIJKLMNOPQRSTU$#@%!abcdefghijklmnopqrstuvw-=";
charset = base62.indexCharset(charset);

base62.encode(999, charset);  // "F3"
base62.decode("F3", charset); // 999

Note that indexCharset typically expects the respective string to contain exactly 62 unique character, but does not validate this for efficieny. In fact, it's also possible to use characters sets with more than 62 characters in order to achieve shorter identifiers for large numbers.

Legacy API

Base62.js v1.x's API is maintained for backwards compatibility.

var base62 = require("base62");

base62.encode(999);  // "g7"
base62.decode("g7"); // 999

This uses the default ASCII character set for encoding/decoding.

It's also possible to define a custom character set instead:

var base62 = require("base62");

var charset = "~9876543210ABCDEFGHIJKLMNOPQRSTU$#@%!abcdefghijklmnopqrstuvw-=";
base62.setCharacterSet(charset);

base62.encode(999);  // "F3"
base62.decode("F3"); // 999

setCharacterSet ensures that the respective string contains exactly 62 unique characters.

Development

Source code is hosted on GitHub. Please report issues or feature requests in GitHub Issues.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Send me a pull request. Bonus points for topic branches.

Release Process for Maintainers

  • Update the version number in package.json.
  • Commit this change with the respective version number as commit message (e.g. "1.2.3").
  • Create an annotated tag, using the prefixed version number (e.g. git tag -am "1.2.3" v1.2.3).
  • Publish the new version: git push --tags origin master and npm publish.

Copyright

Copyright (c) 2016 Andrew Nesbitt. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].