base58

encode. Namespace

base58

Description:
  • Provides methods for Base58 encoding and decoding. This namespace includes functions to encode and decode strings in Base58 format, which is commonly used for data representation in applications like Bitcoin addresses.

Methods

(static) decode(base58String) → {Buffer}

Description:
  • Decodes a Base58 encoded string back into a Buffer.
Example
const decoded = base58.decode('2NEpo7TZRRrLZSi2U');
console.log(decoded.toString()); // Outputs: Hello, World!
Parameters:
Name Type Description
base58String string The Base58 string to decode.
Returns:
The decoded Buffer.
Type
Buffer

(static) encode(inputBuffer) → {string}

Description:
  • Encodes a Buffer or string into Base58 format.
Example
const encoded = base58.encode(Buffer.from('Hello, World!'));
console.log(encoded); // Outputs: 2NEpo7TZRRrLZSi2U
Parameters:
Name Type Description
inputBuffer Buffer | string The data to encode.
Returns:
The Base58 encoded string.
Type
string