Package Exports
- basex-encoder
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (basex-encoder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
# or
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');
// or
const base6 = encoder('abcdef', 'utf8');
// encode from string to string
const encoded = base58.encode('text to encode');
// decode from string to string
const decoded = base58.decode(encoded);
// encode from buffer to string
const encoded = base58.encodeFromBuffer(rawBuffer);
// decode from string to buffer
const decodedBuffer = base58.decodeToBuffer(encoded);