HBMediaType

public struct HBMediaType : CustomStringConvertible

Define media type of file

  • general category

    Declaration

    Swift

    public let type: Category
  • exact kind of data specified

    Declaration

    Swift

    public let subType: String
  • optional parameter

    Declaration

    Swift

    public let parameter: (name: String, value: String)?
  • Initialize HBMediaType

    Declaration

    Swift

    public init(type: Category, subType: String = "*", parameter: (String, String)? = nil)

    Parameters

    type

    category

    subType

    specific kind of data

  • Construct HBMediaType from header value

    Declaration

    Swift

    public init?(from header: String)
  • Return media type with new parameter

    Declaration

    Swift

    public func withParameter(name: String, value: String) -> HBMediaType
  • Output

    Declaration

    Swift

    public var description: String { get }
  • Return if media type matches the input

    Declaration

    Swift

    public func isType(_ type: HBMediaType) -> Bool
  • Get media type from a file extension

    Declaration

    Swift

    public static func getMediaType(forExtension: String) -> HBMediaType?

    Parameters

    extension

    file extension

    Return Value

    media type

  • Media type categories

    See more

    Declaration

    Swift

    public enum Category : String, Equatable
  • Undocumented

    Declaration

    Swift

    public static var application: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var audio: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var example: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var font: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var image: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var message: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var model: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var multipart: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var text: `Self` { get }
  • Undocumented

    Declaration

    Swift

    public static var video: `Self` { get }
  • AbiWord document

    Declaration

    Swift

    public static var applicationAbiWord: `Self` { get }
  • Archive document (multiple files embedded)

    Declaration

    Swift

    public static var applicationArc: `Self` { get }
  • OGG

    Declaration

    Swift

    public static var applicationOgg: `Self` { get }
  • Amazon Kindle eBook format

    Declaration

    Swift

    public static var applicationAmzKindleEBook: `Self` { get }
  • Any kind of binary data

    Declaration

    Swift

    public static var applicationBinary: `Self` { get }
  • BZip archive

    Declaration

    Swift

    public static var applicationBzip: `Self` { get }
  • BZip2 archive

    Declaration

    Swift

    public static var applicationBzip2: `Self` { get }
  • C-Shell script

    Declaration

    Swift

    public static var applicationCsh: `Self` { get }
  • Microsoft Word

    Declaration

    Swift

    public static var applicationMsword: `Self` { get }
  • Microsoft Word (OpenXML)

    Declaration

    Swift

    public static var applicationDocx: `Self` { get }
  • MS Embedded OpenType fonts

    Declaration

    Swift

    public static var applicationEot: `Self` { get }
  • Electronic publication (EPUB)

    Declaration

    Swift

    public static var applicationEpub: `Self` { get }
  • GZip Compressed Archive

    Declaration

    Swift

    public static var applicationGzip: `Self` { get }
  • Java Archive (JAR)

    Declaration

    Swift

    public static var applicationJar: `Self` { get }
  • JSON format

    Declaration

    Swift

    public static var applicationJson: `Self` { get }
  • JSON-LD format

    Declaration

    Swift

    public static var applicationJsonLD: `Self` { get }
  • Apple Installer Package

    Declaration

    Swift

    public static var applicationMpkg: `Self` { get }
  • URL encoded form data

    Declaration

    Swift

    public static var applicationUrlEncoded: `Self` { get }
  • OpenDocument presentation document

    Declaration

    Swift

    public static var applicationOdp: `Self` { get }
  • OpenDocument spreadsheet document

    Declaration

    Swift

    public static var applicationOds: `Self` { get }
  • OpenDocument text document

    Declaration

    Swift

    public static var applicationOdt: `Self` { get }
  • Adobe Portable Document Format

    Declaration

    Swift

    public static var applicationPdf: `Self` { get }
  • Hypertext Preprocessor

    Declaration

    Swift

    public static var applicationPhp: `Self` { get }
  • Microsoft PowerPoint

    Declaration

    Swift

    public static var applicationPpt: `Self` { get }
  • Microsoft PowerPoint (OpenXML)

    Declaration

    Swift

    public static var applicationPptx: `Self` { get }
  • RAR archive

    Declaration

    Swift

    public static var applicationRar: `Self` { get }
  • Rich Text Format (RTF)

    Declaration

    Swift

    public static var applicationRtf: `Self` { get }
  • Bourne shell script

    Declaration

    Swift

    public static var applicationSh: `Self` { get }
  • Small web format (SWF) or Adobe Flash document

    Declaration

    Swift

    public static var applicationSwf: `Self` { get }
  • Tape Archive (TAR)

    Declaration

    Swift

    public static var applicationTar: `Self` { get }
  • Microsoft Visio

    Declaration

    Swift

    public static var applicationVsd: `Self` { get }
  • XHTML

    Declaration

    Swift

    public static var applicationXhtml: `Self` { get }
  • Microsoft Excel

    Declaration

    Swift

    public static var applicationXls: `Self` { get }
  • Microsoft Excel (OpenXML)

    Declaration

    Swift

    public static var applicationXlsx: `Self` { get }
  • XML

    Declaration

    Swift

    public static var applicationXml: `Self` { get }
  • ZIP archive

    Declaration

    Swift

    public static var applicationZip: `Self` { get }
  • 7-zip archive

    Declaration

    Swift

    public static var application7z: `Self` { get }
  • Text, (generally ASCII or ISO 8859-n)

    Declaration

    Swift

    public static var textPlain: `Self` { get }
  • iCalendar format

    Declaration

    Swift

    public static var textICalendar: `Self` { get }
  • Cascading Style Sheets (CSS)

    Declaration

    Swift

    public static var textCss: `Self` { get }
  • Comma-separated values (CSV)

    Declaration

    Swift

    public static var textCsv: `Self` { get }
  • HyperText Markup Language (HTML)

    Declaration

    Swift

    public static var textHtml: `Self` { get }
  • JavaScript

    Declaration

    Swift

    public static var textJavascript: `Self` { get }
  • Windows OS/2 Bitmap Graphics

    Declaration

    Swift

    public static var imageBmp: `Self` { get }
  • Graphics Interchange Format (GIF)

    Declaration

    Swift

    public static var imageGif: `Self` { get }
  • Icon format

    Declaration

    Swift

    public static var imageIco: `Self` { get }
  • JPEG images

    Declaration

    Swift

    public static var imageJpeg: `Self` { get }
  • Portable Network Graphics

    Declaration

    Swift

    public static var imagePng: `Self` { get }
  • Scalable Vector Graphics (SVG)

    Declaration

    Swift

    public static var imageSvg: `Self` { get }
  • Tagged Image File Format (TIFF)

    Declaration

    Swift

    public static var imageTiff: `Self` { get }
  • WEBP image

    Declaration

    Swift

    public static var imageWebp: `Self` { get }
  • AAC audio

    Declaration

    Swift

    public static var audioAac: `Self` { get }
  • Musical Instrument Digital Interface (MIDI)

    Declaration

    Swift

    public static var audioMidi: `Self` { get }
  • MP3 audio

    Declaration

    Swift

    public static var audioMpeg: `Self` { get }
  • OGG audio

    Declaration

    Swift

    public static var audioOgg: `Self` { get }
  • Waveform Audio Format

    Declaration

    Swift

    public static var audioWave: `Self` { get }
  • WEBM audio

    Declaration

    Swift

    public static var audioWebm: `Self` { get }
  • Opus audio

    Declaration

    Swift

    public static var audioOpus: `Self` { get }
  • 3GPP audio/video container

    Declaration

    Swift

    public static var audio3gp: `Self` { get }
  • 3GPP2 audio/video container

    Declaration

    Swift

    public static var audio3g2: `Self` { get }
  • AVI: Audio Video Interleave

    Declaration

    Swift

    public static var videoMp4: `Self` { get }
  • MPEG Video

    Declaration

    Swift

    public static var videoMpeg: `Self` { get }
  • OGG video

    Declaration

    Swift

    public static var videoOgg: `Self` { get }
  • MPEG transport stream

    Declaration

    Swift

    public static var videoTs: `Self` { get }
  • WEBM video

    Declaration

    Swift

    public static var videoWebm: `Self` { get }
  • 3GPP audio/video container

    Declaration

    Swift

    public static var video3gp: `Self` { get }
  • 3GPP2 audio/video container

    Declaration

    Swift

    public static var video3g2: `Self` { get }
  • OpenType font

    Declaration

    Swift

    public static var fontOtf: `Self` { get }
  • TrueType Font

    Declaration

    Swift

    public static var fontTtf: `Self` { get }
  • Web Open Font Format (WOFF)

    Declaration

    Swift

    public static var fontWoff: `Self` { get }
  • Web Open Font Format (WOFF)

    Declaration

    Swift

    public static var fontWoff2: `Self` { get }
  • Multipart formdata

    Declaration

    Swift

    public static var multipartForm: `Self` { get }
  • map from extension string to media type

    Declaration

    Swift

    static let extensionMediaTypeMap: [String : HBMediaType]