How to output a string representation of a Buffer in a custom base? (ie. octal, base26, base58, base64, ...)
I surprised myself to find it particularly challenging to recode this without external libraries like BN (using only NodeJS native ones at most)
const buff = Buffer.from('a4fe800c32', 'hex');
// OK
console.log(buff.toString('base64'));
// Would like
console.log(buff.toString('base58'));
// Or
const customBase = ['0', '1', '2', 'a', '§', 'K'];
console.log(buff.toString(customBase));