I’m trying to decode the buffer stored in the addr key found in the output returned by the IPFS swarm peers function back to the original string. I tried to use the toString() method with all supported encodings, but the output I’m getting is not correctly decoded.
const swarm_peers = await node.swarm.peers();
console.log(swarm_peers['2']['addr']['buffer'].toString());
Below is a sample output of what I’m getting
6sgp-1.bootstrap.libp2p.io���" BD�38\
How do I correctly decode the buffer?