Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Buffer to String Node.js

I am using Avalanchejs a Javascript SDk to generate an address. After installing all dependencies and running the code. I get a new address, but the address shows up in a format. I tried to use the Buffer.from('xxx') method and then toString(). But it did not work. How can I convert the into a string ?

JS code:

const avalanche = require("avalanche")
const { Avalanche, BinTools, Buffer, BN } = require("avalanche")

const bintools = BinTools.getInstance()

const myNetworkID = 12345 //default is 1, we want to override that for our local network
const avalancheX = new Avalanche("localhost", 9650, "http", myNetworkID)
const xchain = avalancheX.XChain() //returns a reference to the X-Chain used by AvalancheJS

const myKeychain = xchain.keyChain()
const newAddress1 = myKeychain.makeKey() 
console.log(newAddress1.pubk)
var buf = newAddress1.pubk;
console.log(buf.toString());

Terminal Output:

<Buffer 03 cd ab 4d e6 7d ee c5 9f c6 0d 27 e8 3b d2 da ee 84 ce f3 77 20 70 c9 8d 66 47 c7 36 91 ec 1f 07>
'�;������w pɍfG�6��
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda