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

404
Vistas
How to fetch JSON-file from ipfs and display on a webpage (using 'ipfs-core')
import * as IPFS from 'ipfs-core'

var ipfs = await IPFS.create({ repo: 'ok' + Math.random() })

const metadataMap = new Map()

//content.metadataCid is the ipfs-cid of the metadata.json file stored on ipfs.
var res = await ipfs.cat(content.metadataCid)
//var data = await res.Json()

console.log("** Metadata from Cid **")
console.log(res)

//This just maps the content (content-cid) to its metadata
//sets the metadata for each Content
 metadataMap.set(theCid, res)

 if (metadataMap) {
 console.log('**metadata map**')
 console.log(metadataMap)
 }

The console -

enter image description here

I am hosting those metadata files on pinata as well as on my desktop-ipfs. And you can access it using ipfs cli or gateways. eg_link: ipfs://bafybeibro7fxpk7sk2nfvslumxraol437ug35qz4xx2p7ygjctunb2wi3i/

The link opens in the browser using ipfs-gateway just fine: enter image description here

But when I use ipfs.cat(), the console just shows cat {suspended} (as shown in the image attached)]

I can access the image stored on ipfs using "img" tag without any problem:

enter image description here

In the image above, the images are from ipfs. I also wanna show title and description which is stored in that json file on ipfs

Same issue with ipfs.get() !

How can I access that metadata.json file and parse them. Am I missing any step here?

thanks 🤞

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