BaseX Encoder
BaseX Encoder is encoder / decoder for any base X.
It can encode / decode to and from string and buffer
+ Written in TypeScript
+ 0 dependencies
Getting Started
First, install BaseX Encoder using npm.
npm install --save basex-encoder
yarn add basex-encoder
Note: BaseX Encoder assumes a JavaScript environment with global Buffer
. Use safe-buffer to polyfill.
import { encoder } from 'basex-encoder';
const base58 = encoder('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
const base6 = encoder('abcdef', 'utf8');
const encoded = base58.encode('text to encode');
const decoded = base58.decode(encoded);
const encoded = base58.encodeFromBuffer(rawBuffer);
const decodedBuffer = base58.decodeToBuffer(encoded);