Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
How do I convert my IPFS return into the original .midi or .png file using js (ipfs-http-client)?

I have images and audio files stored in IPFS. When I retrieve the contents in javascript I end up with a Buffer or a tarballed header/body output. How do I convert this back into the original file to use on the website?

const audioCID = CID.parse("QmapPj7koCCMp241CAhwZV413K3FrqVnYdKC2GeTQHsCuF")
const output = await pipe(
    ipfs.get(audioCID),
    // tarballed,
    collect
)   

The output I get is:

output [
  <Buffer 51 6d 61 70 50 6a 37 6b 6f 43 43 4d 70 32 34 31 43 41 68 77 5a 56 34 31 33 4b 33 46 72 71 56 6e 59 64 4b 43 32 47 65 54 51 48 73 43 75 46 00 00 00 00 ... 1998 more bytes>
]
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The output (converting to ASCII) is the CID:

51 6d 61 70 50 6a 37 6b 6f 43 43 4d 70 32 34 31 43 41 68 77 5a 56 34 31 33 4b 33 46 72 71 56 6e 59 64 4b 43 32 47 65 54 51 48 73 43 75 46 00 00 00 00

=

QmapPj7koCCMp241CAhwZV413K3FrqVnYdKC2GeTQHsCuF

Source: https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html

Solution:

You need to get the content of the IPFS file with ipfs.cat: https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda