struct
Athena::MIME::NativeTypesGuesser
- Athena::MIME::NativeTypesGuesser
- Struct
- Value
- Object
Overview
A AMIME::TypesGuesserInterface implementation based Crystal's MIME module.
This guesser is mainly intended as a fallback for when AMIME::MagicTypesGuesser isn't available (MSVC Windows).
Included Modules
Defined in:
native_types_guesser.crConstructors
Instance Method Summary
-
#guess_mime_type(path : String | Path) : String | Nil
Returns the guessed MIME type for the file at the provided path, or
nilif it could not be determined. - #initialize
-
#supported? : Bool
Returns
trueif this guesser is supported, otherwisefalse.
Instance methods inherited from module Athena::MIME::TypesGuesserInterface
guess_mime_type(path : String | Path) : String | Nil
guess_mime_type,
supported? : Bool
supported?
Constructor Detail
Instance Method Detail
def guess_mime_type(path : String | Path) : String | Nil
#
Returns the guessed MIME type for the file at the provided path,
or nil if it could not be determined.
How exactly the MIME type is determined is up to each individual implementation.
guesser.guess_mime_type "/path/to/image.png" # => "image/png"
NOTE Guessing is based solely on the extension of the provided path.
def supported? : Bool
#
Returns true if this guesser is supported, otherwise false.
The value may be cached on the class level.