'How to check that an ipfs hash is an image/video/.. in React Js?

I need to use the ipfs hash to find out whether the file is an image or a video so that i can use it to either show the image/play the video. Couldn't find any useful resource on this one. What should be done?



Solution 1:[1]

You can't find it just by using the ipfs hash. You're gonna have to fetch the file and find the mime type of it. Check out these threads 1 2

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 notnavindu