Mime

public struct Mime : Hashable, Codable

A struct that allows parsing urls and file extensions to mime types.

  • The mime type’s string representation.

    Declaration

    Swift

    public let mime: String
  • ext

    The mime type’s originating file extension.

    Declaration

    Swift

    public let ext: String
  • The file type enum

    Declaration

    Swift

    public let type: FileType
  • Initializes and returns the MimeType object from the given file extension and falls back to application/octet-stream when given an unknown extension.

    Declaration

    Swift

    public init(ext: String)

    Parameters

    ext

    The file extension

  • Initializes and returns the MimeType obejct from the given url and falls back to application/octet-stream when given an unknown extension.

    Declaration

    Swift

    public init(url: URL)
  • Creates a new instance by decoding from the given decoder.

    Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Encodes this mime type into the given encoder.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws