Base32 encoding/decoding (#652)
* Base32 encoding/decoding * Attribution * LOOKUP * Share base32/58 alphabet validation * Apply suggestions from code review
This commit is contained in:
@@ -12,8 +12,12 @@ import { bs58 } from './bs58';
|
||||
* @description
|
||||
* From the provided input, create the base58 and return the result as a string.
|
||||
*/
|
||||
export default function base58Encode (value: Uint8Array | string | Buffer | number[]): string {
|
||||
return bs58.encode(
|
||||
export default function base58Encode (value: Uint8Array | string | Buffer | number[], ipfsCompat = false): string {
|
||||
const out = bs58.encode(
|
||||
u8aToBuffer(u8aToU8a(value))
|
||||
);
|
||||
|
||||
return ipfsCompat
|
||||
? `z${out}`
|
||||
: out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user