Package Exports
- base58-js
- base58-js/package
- base58-js/package.json
- base58-js/public/base58_to_binary.js
- base58-js/public/binary_to_base58.js
- base58-js/public/index.js
- base58-js/public/index.mjs
Readme
base58-js
A light weight (~560 byte) universal JavaScript base58 encoder / decoder.
Support
- Node.js
>= 8
- Browser list
defaults
not IE 11
.
Setup
$ npm i base58-js
API
namespace base58_chars
Base58 characters must only include numbers 123456789, uppercase ABCDEFGHJKLMNPQRSTUVWXYZ and lowercase abcdefghijkmnopqrstuvwxyz.
Type: string
function base58_to_binary
Converts a base58
string to its corresponding binary representation.
Parameter | Type | Description |
---|---|---|
base58String |
base58_chars | base58 encoded string |
Returns: Uint8Array — binary representation for the base58 string.
Examples
Ways to import
.
import { base58_to_binary } from 'base58-js'
Ways to require
.
const { base58_to_binary } = require('base58-js')
Usage.
const bin = base58_to_binary('6MRy') console.log(bin)Logged output will be Uint8Array(3) [15, 239, 64].
function binary_to_base58
Converts a Uint8Array into a base58 string.
Parameter | Type | Description |
---|---|---|
uint8array |
Uint8Array | Array | Unsigned integer. |
Returns: base58_chars — The base58 string representation of the binary array.
Examples
Ways to require
.
const { binary_to_base58 } = require('base58-js')
Ways to import
.
import { binary_to_base58 } from 'base58-js'
Usage.
const str = binary_to_base58([15, 239, 64]) console.log(str)Logged output will be 6MRy.