pub fn guess_kind<P: AsRef<Path>>(path: P) -> Result<&'static str, Error>Expand description
Sniff the file type by reading magic bytes from the start of path.
§Supported formats
| Magic bytes | Offset | Format |
|---|---|---|
PK\x03\x04 + mimetypeapplication/epub+zip | 0 / 30 | epub |
%PDF | 0 | pdf |
AT&T | 0 | djvu |
RIFF + WEBP | 0 / 8 | webp |
WebP files start with "RIFF" and have "WEBP" at bytes 8–11.
RIFF alone is not enough because many non-WebP formats (WAV, AVI, …)
are also RIFF containers.