getFileTypeFromHash
Returns the file type based on the file hash. What is a file hash and where to find it
function getFileTypeFromHash(hash: string): HashMediaType
declare type HashMediaType = 'file' | 'video' | 'image' | 'audio'
Accepts: File hash
Returns: File type. Possible values: file, image, video, audio
Example
import {getFileTypeFromHash} from '@app/storage'
import {jsx} from '@app/html-jsx'
app.html('/', () => {
const hash = 'image_aB3kHmKgLn.7301x4873.jpeg'
return <html><body>
File type: {getFileTypeFromHash(hash)}
</body></html>
})