method
Mime.sniff
Mime.sniff(path) -> string
Reads the file's leading bytes and recognises well-known signatures (PNG, JPEG, GIF, PDF), so a mislabelled or extension-less file is still identified. Falls back to Mime.of when no signature matches or the file cannot be read.
Parameters
paththe path to inspectExample
program MimeSniff {
entry {
let kind = Mime.sniff("download.bin")
print(len(kind))
}
}