fractal::utils::media

Function filename_for_mime

source
pub fn filename_for_mime(
    mime_type: Option<&str>,
    fallback: Option<Name<'_>>,
) -> String
Expand description

Get a default filename for a mime type.

Tries to guess the file extension, but it might not find it.

If the mime type is unknown, it uses the name for fallback. The fallback mime types that are recognized are mime::IMAGE, mime::VIDEO and mime::AUDIO, other values will behave the same as None.