I fetch the file via fetch api.
I finally get something like this:
const result = response.blob()
currently, result.type returns image/jpeg. What I need to do is check if the file returned is a directory or image or text file.
One way is to do this:
if(result.type.includes('image')){
}
I am wondering if there's any other way without hardcoding image string like the above.
blob.isImagewould be great. blob.isDirectory would be great. some wrapper which makes it easier so i don't have to write hardcoded strings myself