0

I'm building an app that fetches IPFS media on a certain page. I'm currently using the <object/> tag to dynamically handle images and video but it doesn't work great.

In the app, I fetch the details of an item that stores media on ipfs so I'll get a hash and then load the src='' using an ipfs gateway provider. However, the hash does not tell me if the asset is an image, video, or an svg so I don't have a way to use the correct HTML tag. Are there any npm packages that handle all types of media?

Also, are there any good npm packages/methods to safely run arbitrary svg files?

michecode
  • 85
  • 5
  • 1
    Can you try getting the mime type using this JavaScript solution? https://stackoverflow.com/questions/72026051/how-to-find-mime-type-of-ipfs-no-extension-given-using-javascript – Pandemonium Sep 28 '22 at 17:09

0 Answers0