Multi-system base 32 <-> binary conversion.
npm install base32-converterbash
npm install base32-converter
`
Usage
`javascript
var Base32Converter = require('base32-converter');
var converter = new Base32Converter(Base32Converter.system.RFC4648);
var val = converter.encode('10111');
console.log(val); // prints 'X'
console.log(converter.decode(val)); // prints '10111'
`Documentation
$3
Generates a new instance of the Base32Converter class. The system parameter can take multiple forms. If the system parameter is not supplied, the library will default to the Havi base 32 system. To use a built-in base 32 system, pass the system constant to the constructor.__Example__
`javascript
var convert = new Base32Converter(Base32Converter.system.Crockford);
`
Base32Converter also supports bringing your own system for base 32 conversion. There are two supported methods for doing this. You can either: 1. Supply a string of 32 unique characters as the system parameter to the constructor.
2. Create a custom system using an object hash. The parameters of the object are
validCharacters, characterSubstitutions, and pad.
- validCharacters(string): String of 32 unique characters to use for the base 32 system. (__required__)
- characterSubstituions(object): Object whose keys are characters you'd like replaced and value representing replacing characters. (optional)
- pad(string): Character to use for padding. (optional)__Examples__
`javascript
// ---- Using a string
var convert = new Base32Converter('123456789ABCDEFGHIJKLMNOPQRSTUVW');// ---- Using an object
var convert = new Base32Converter({
validCharacters: '123456789ABCDEFGHIJKLMNOPQRSTUVW',
characterSubstitutions: {
'0': 'O'
},
pad: '0'
});
``##### Base32Converter.system.Havi
##### Base32Converter.system.RFC4648
##### Base32Converter.system.z-base-32
##### Base32Converter.system.Crockford
##### Base32Converter.system.base32hex