0001
0025 enum MediaTypeError: ErrorType {
0026 case MalformedMediaTypeString
0027 }
0028
0029 public struct MediaType| MediaType.swift:77 | public func matches(mediaType: MediaType) -> Bool { |
| MediaType.swift:94 | extension MediaType: Hashable { |
| MediaType.swift:100 | public func ==(lhs: MediaType, rhs: MediaType) -> Bool { |
| MediaType.swift:100 | public func ==(lhs: MediaType, rhs: MediaType) -> Bool { |
| MediaType.swift:141 | public let JSONMediaType = MediaType(type: "application", subtype: "json", parameters: ["charset": "utf-8"]) |
| MediaType.swift:142 | public let XMLMediaType = MediaType(type: "application", subtype: "xml", parameters: ["charset": "utf-8"]) |
| MediaType.swift:143 | public let URLEncodedFormMediaType = MediaType(type: "application", subtype: "x-www-form-urlencoded") |
| MediaType.swift:144 | public let multipartFormMediaType = MediaType(type: "multipart", subtype: "form-data") |
| MediaType.swift:691 | public func mediaTypeForFileExtension(fileExtension: String) -> MediaType? { |
| MediaType.swift:695 | return MediaType(string: mime) |
: CustomStringConvertible {
0030 public let type| MediaType.swift:35 | self.type = type |
| MediaType.swift:41 | var string = "\(type)/\(subtype)" |
| MediaType.swift:72 | self.type = tokens[0].lowercaseString |
| MediaType.swift:78 | if type == "*" || mediaType.type == "*" { |
| MediaType.swift:78 | if type == "*" || mediaType.type == "*" { |
| MediaType.swift:82 | if type == mediaType.type { |
| MediaType.swift:82 | if type == mediaType.type { |
| MediaType.swift:96 | return type.hashValue ^ subtype.hashValue |
| MediaType.swift:101 | return lhs.type == rhs.type && lhs.subtype == rhs.subtype |
| MediaType.swift:101 | return lhs.type == rhs.type && lhs.subtype == rhs.subtype |
: String
0031 public let subtype| MediaType.swift:36 | self.subtype = subtype |
| MediaType.swift:41 | var string = "\(type)/\(subtype)" |
| MediaType.swift:73 | self.subtype = tokens[1].lowercaseString |
| MediaType.swift:83 | if subtype == "*" || mediaType.subtype == "*" { |
| MediaType.swift:83 | if subtype == "*" || mediaType.subtype == "*" { |
| MediaType.swift:87 | return subtype == mediaType.subtype |
| MediaType.swift:87 | return subtype == mediaType.subtype |
| MediaType.swift:96 | return type.hashValue ^ subtype.hashValue |
| MediaType.swift:101 | return lhs.type == rhs.type && lhs.subtype == rhs.subtype |
| MediaType.swift:101 | return lhs.type == rhs.type && lhs.subtype == rhs.subtype |
: String
0032 public let parameters| MediaType.swift:37 | self.parameters = parameters |
| MediaType.swift:43 | if parameters.count > 0 { |
| MediaType.swift:44 | string += parameters.reduce(";") { $0 + " \($1.0)=\($1.1)" } |
| MediaType.swift:74 | self.parameters = parameters |
: [String: String]
0033
0034 public init| MediaType.swift:141 | public let JSONMediaType = MediaType(type: "application", subtype: "json", parameters: ["charset": "utf-8"]) |
| MediaType.swift:142 | public let XMLMediaType = MediaType(type: "application", subtype: "xml", parameters: ["charset": "utf-8"]) |
| MediaType.swift:143 | public let URLEncodedFormMediaType = MediaType(type: "application", subtype: "x-www-form-urlencoded") |
| MediaType.swift:144 | public let multipartFormMediaType = MediaType(type: "multipart", subtype: "form-data") |
(type: String, subtype: String, parameters: [String: String] = [:]) {
0035 self.type = type
0036 self.subtype = subtype
0037 self.parameters = parameters
0038 }
0039
0040 public var description: String {
0041 var string = "\(type)/\(subtype)"
0042
0043 if parameters.count > 0 {
0044 string += parameters.reduce(";") { $0 + " \($1.0)=\($1.1)" }
0045 }
0046
0047 return string
0048 }
0049
0050 public init| MediaType.swift:695 | return MediaType(string: mime) |
(string: String) {
0051 let mediaTypeTokens = string.split(";")
0052
0053 let mediaType = mediaTypeTokens.first!
0054 var parameters: [String: String] = [:]
0055
0056 if mediaTypeTokens.count == 2 {
0057 let parametersTokens = mediaTypeTokens[1].trim().split(" ")
0058
0059 for parametersToken in parametersTokens {
0060 let parameterTokens = parametersToken.split("=")
0061
0062 if parameterTokens.count == 2 {
0063 let key = parameterTokens[0]
0064 let value = parameterTokens[1]
0065 parameters[key] = value
0066 }
0067 }
0068 }
0069
0070 let tokens = mediaType.split("/")
0071
0072 self.type = tokens[0].lowercaseString
0073 self.subtype = tokens[1].lowercaseString
0074 self.parameters = parameters
0075 }
0076
0077 public func matches(mediaType: MediaType) -> Bool {
0078 if type == "*" || mediaType.type == "*" {
0079 return true
0080 }
0081
0082 if type == mediaType.type {
0083 if subtype == "*" || mediaType.subtype == "*" {
0084 return true
0085 }
0086
0087 return subtype == mediaType.subtype
0088 }
0089
0090 return false
0091 }
0092 }
0093
0094 extension MediaType: Hashable {
0095 public var hashValue: Int {
0096 return type.hashValue ^ subtype.hashValue
0097 }
0098 }
0099
0100 public func ==(lhs: MediaType, rhs: MediaType) -> Bool {
0101 return lhs.type == rhs.type && lhs.subtype == rhs.subtype
0102 }
0103
0104 extension String {
0105 func split| MediaType.swift:51 | let mediaTypeTokens = string.split(";") |
| MediaType.swift:57 | let parametersTokens = mediaTypeTokens[1].trim().split(" ") |
| MediaType.swift:60 | let parameterTokens = parametersToken.split("=") |
| MediaType.swift:70 | let tokens = mediaType.split("/") |
(separator: Character, allowEmptySlices: Bool = false) -> [String] {
0106 return characters.split(separator, allowEmptySlices: allowEmptySlices).map(String.init)
0107 }
0108
0109 func trim| MediaType.swift:57 | let parametersTokens = mediaTypeTokens[1].trim().split(" ") |
() -> String {
0110 let string = trimLeft()
0111 return string.trimRight()
0112 }
0113
0114 func trimLeft| MediaType.swift:110 | let string = trimLeft() |
() -> String {
0115 var start = characters.count
0116
0117 for (index, character) in characters.enumerate() {
0118 if ![" ", "\t", "\r", "\n"].contains(character) {
0119 start = index
0120 break
0121 }
0122 }
0123
0124 return self[startIndex.advancedBy(start) ..< endIndex]
0125 }
0126
0127 func trimRight| MediaType.swift:111 | return string.trimRight() |
() -> String {
0128 var end = characters.count
0129
0130 for (index, character) in characters.reverse().enumerate() {
0131 if ![" ", "\t", "\r", "\n"].contains(character) {
0132 end = index
0133 break
0134 }
0135 }
0136
0137 return self[startIndex ..< startIndex.advancedBy(characters.count - end)]
0138 }
0139 }
0140
0141 public let JSONMediaType = MediaType(type: "application", subtype: "json", parameters: ["charset": "utf-8"])
0142 public let XMLMediaType = MediaType(type: "application", subtype: "xml", parameters: ["charset": "utf-8"])
0143 public let URLEncodedFormMediaType = MediaType(type: "application", subtype: "x-www-form-urlencoded")
0144 public let multipartFormMediaType = MediaType(type: "multipart", subtype: "form-data")
0145
0146 let fileExtensionMediaTypeMapping| MediaType.swift:692 | guard let mime = fileExtensionMediaTypeMapping[fileExtension] else { |
: [String: String] = [
0147 "ez": "application/andrew-inset",
0148 "anx": "application/annodex",
0149 "atom": "application/atom+xml",
0150 "atomcat": "application/atomcat+xml",
0151 "atomsrv": "application/atomserv+xml",
0152 "lin": "application/bbolin",
0153 "cu": "application/cu-seeme",
0154 "davmount": "application/davmount+xml",
0155 "dcm": "application/dicom",
0156 "tsp": "application/dsptype",
0157 "es": "application/ecmascript",
0158 "spl": "application/futuresplash",
0159 "hta": "application/hta",
0160 "jar": "application/java-archive",
0161 "ser": "application/java-serialized-object",
0162 "class": "application/java-vm",
0163 "js": "application/javascript",
0164 "json": "application/json",
0165 "m3g": "application/m3g",
0166 "hqx": "application/mac-binhex40",
0167 "cpt": "application/mac-compactpro",
0168 "nb": "application/mathematica",
0169 "nbp": "application/mathematica",
0170 "mbox": "application/mbox",
0171 "mdb": "application/msaccess",
0172 "doc": "application/msword",
0173 "dot": "application/msword",
0174 "mxf": "application/mxf",
0175 "bin": "application/octet-stream",
0176 "oda": "application/oda",
0177 "ogx": "application/ogg",
0178 "one": "application/onenote",
0179 "onetoc2": "application/onenote",
0180 "onetmp": "application/onenote",
0181 "onepkg": "application/onenote",
0182 "pdf": "application/pdf",
0183 "pgp": "application/pgp-encrypted",
0184 "key": "application/pgp-keys",
0185 "sig": "application/pgp-signature",
0186 "prf": "application/pics-rules",
0187 "ps": "application/postscript",
0188 "ai": "application/postscript",
0189 "eps": "application/postscript",
0190 "epsi": "application/postscript",
0191 "epsf": "application/postscript",
0192 "eps2": "application/postscript",
0193 "eps3": "application/postscript",
0194 "rar": "application/rar",
0195 "rdf": "application/rdf+xml",
0196 "rtf": "application/rtf",
0197 "stl": "application/sla",
0198 "smi": "application/smil+xml",
0199 "smil": "application/smil+xml",
0200 "xhtml": "application/xhtml+xml",
0201 "xht": "application/xhtml+xml",
0202 "xml": "application/xml",
0203 "xsd": "application/xml",
0204 "xsl": "application/xslt+xml",
0205 "xslt": "application/xslt+xml",
0206 "xspf": "application/xspf+xml",
0207 "zip": "application/zip",
0208 "apk": "application/vnd.android.package-archive",
0209 "cdy": "application/vnd.cinderella",
0210 "kml": "application/vnd.google-earth.kml+xml",
0211 "kmz": "application/vnd.google-earth.kmz",
0212 "xul": "application/vnd.mozilla.xul+xml",
0213 "xls": "application/vnd.ms-excel",
0214 "xlb": "application/vnd.ms-excel",
0215 "xlt": "application/vnd.ms-excel",
0216 "xlam": "application/vnd.ms-excel.addin.macroEnabled.12",
0217 "xlsb": "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
0218 "xlsm": "application/vnd.ms-excel.sheet.macroEnabled.12",
0219 "xltm": "application/vnd.ms-excel.template.macroEnabled.12",
0220 "eot": "application/vnd.ms-fontobject",
0221 "thmx": "application/vnd.ms-officetheme",
0222 "cat": "application/vnd.ms-pki.seccat",
0223 "ppt": "application/vnd.ms-powerpoint",
0224 "pps": "application/vnd.ms-powerpoint",
0225 "ppam": "application/vnd.ms-powerpoint.addin.macroEnabled.12",
0226 "pptm": "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
0227 "sldm": "application/vnd.ms-powerpoint.slide.macroEnabled.12",
0228 "ppsm": "application/vnd.ms-powerpoint.slideshow.macroEnabled.12",
0229 "potm": "application/vnd.ms-powerpoint.template.macroEnabled.12",
0230 "docm": "application/vnd.ms-word.document.macroEnabled.12",
0231 "dotm": "application/vnd.ms-word.template.macroEnabled.12",
0232 "odc": "application/vnd.oasis.opendocument.chart",
0233 "odb": "application/vnd.oasis.opendocument.database",
0234 "odf": "application/vnd.oasis.opendocument.formula",
0235 "odg": "application/vnd.oasis.opendocument.graphics",
0236 "otg": "application/vnd.oasis.opendocument.graphics-template",
0237 "odi": "application/vnd.oasis.opendocument.image",
0238 "odp": "application/vnd.oasis.opendocument.presentation",
0239 "otp": "application/vnd.oasis.opendocument.presentation-template",
0240 "ods": "application/vnd.oasis.opendocument.spreadsheet",
0241 "ots": "application/vnd.oasis.opendocument.spreadsheet-template",
0242 "odt": "application/vnd.oasis.opendocument.text",
0243 "odm": "application/vnd.oasis.opendocument.text-master",
0244 "ott": "application/vnd.oasis.opendocument.text-template",
0245 "oth": "application/vnd.oasis.opendocument.text-web",
0246 "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
0247 "sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide",
0248 "ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
0249 "potx": "application/vnd.openxmlformats-officedocument.presentationml.template",
0250 "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
0251 "xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
0252 "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
0253 "dotx": "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
0254 "cod": "application/vnd.rim.cod",
0255 "mmf": "application/vnd.smaf",
0256 "sdc": "application/vnd.stardivision.calc",
0257 "sds": "application/vnd.stardivision.chart",
0258 "sda": "application/vnd.stardivision.draw",
0259 "sdd": "application/vnd.stardivision.impress",
0260 "sdf": "application/vnd.stardivision.math",
0261 "sdw": "application/vnd.stardivision.writer",
0262 "sgl": "application/vnd.stardivision.writer-global",
0263 "sxc": "application/vnd.sun.xml.calc",
0264 "stc": "application/vnd.sun.xml.calc.template",
0265 "sxd": "application/vnd.sun.xml.draw",
0266 "std": "application/vnd.sun.xml.draw.template",
0267 "sxi": "application/vnd.sun.xml.impress",
0268 "sti": "application/vnd.sun.xml.impress.template",
0269 "sxm": "application/vnd.sun.xml.math",
0270 "sxw": "application/vnd.sun.xml.writer",
0271 "sxg": "application/vnd.sun.xml.writer.global",
0272 "stw": "application/vnd.sun.xml.writer.template",
0273 "sis": "application/vnd.symbian.install",
0274 "cap": "application/vnd.tcpdump.pcap",
0275 "pcap": "application/vnd.tcpdump.pcap",
0276 "vsd": "application/vnd.visio",
0277 "wbxml": "application/vnd.wap.wbxml",
0278 "wmlc": "application/vnd.wap.wmlc",
0279 "wmlsc": "application/vnd.wap.wmlscriptc",
0280 "wpd": "application/vnd.wordperfect",
0281 "wp5": "application/vnd.wordperfect5.1",
0282 "wk": "application/x-123",
0283 "7z": "application/x-7z-compressed",
0284 "abw": "application/x-abiword",
0285 "dmg": "application/x-apple-diskimage",
0286 "bcpio": "application/x-bcpio",
0287 "torrent": "application/x-bittorrent",
0288 "cab": "application/x-cab",
0289 "cbr": "application/x-cbr",
0290 "cbz": "application/x-cbz",
0291 "cdf": "application/x-cdf",
0292 "cda": "application/x-cdf",
0293 "vcd": "application/x-cdlink",
0294 "pgn": "application/x-chess-pgn",
0295 "mph": "application/x-comsol",
0296 "cpio": "application/x-cpio",
0297 "csh": "application/x-csh",
0298 "deb": "application/x-debian-package",
0299 "udeb": "application/x-debian-package",
0300 "dcr": "application/x-director",
0301 "dir": "application/x-director",
0302 "dxr": "application/x-director",
0303 "dms": "application/x-dms",
0304 "wad": "application/x-doom",
0305 "dvi": "application/x-dvi",
0306 "pfa": "application/x-font",
0307 "pfb": "application/x-font",
0308 "gsf": "application/x-font",
0309 "pcf": "application/x-font",
0310 "pcf.Z": "application/x-font",
0311 "woff": "application/x-font-woff",
0312 "mm": "application/x-freemind",
0313 "gan": "application/x-ganttproject",
0315 "gnumeric": "application/x-gnumeric",
0316 "sgf": "application/x-go-sgf",
0317 "gcf": "application/x-graphing-calculator",
0318 "gtar": "application/x-gtar",
0319 "tgz": "application/x-gtar-compressed",
0320 "taz": "application/x-gtar-compressed",
0321 "hdf": "application/x-hdf",
0322 "hwp": "application/x-hwp",
0323 "ica": "application/x-ica",
0324 "info": "application/x-info",
0325 "ins": "application/x-internet-signup",
0326 "isp": "application/x-internet-signup",
0327 "iii": "application/x-iphone",
0328 "iso": "application/x-iso9660-image",
0329 "jam": "application/x-jam",
0330 "jnlp": "application/x-java-jnlp-file",
0331 "jmz": "application/x-jmol",
0332 "chrt": "application/x-kchart",
0333 "kil": "application/x-killustrator",
0334 "skp": "application/x-koan",
0335 "skd": "application/x-koan",
0336 "skt": "application/x-koan",
0337 "skm": "application/x-koan",
0338 "kpr": "application/x-kpresenter",
0339 "kpt": "application/x-kpresenter",
0340 "ksp": "application/x-kspread",
0341 "kwd": "application/x-kword",
0342 "kwt": "application/x-kword",
0343 "latex": "application/x-latex",
0344 "lha": "application/x-lha",
0345 "lyx": "application/x-lyx",
0346 "lzh": "application/x-lzh",
0347 "lzx": "application/x-lzx",
0348 "frm": "application/x-maker",
0349 "maker": "application/x-maker",
0350 "frame": "application/x-maker",
0351 "fm": "application/x-maker",
0352 "fb": "application/x-maker",
0353 "book": "application/x-maker",
0354 "fbdoc": "application/x-maker",
0355 "md5": "application/x-md5",
0356 "mif": "application/x-mif",
0357 "m3u8": "application/x-mpegURL",
0358 "wmd": "application/x-ms-wmd",
0359 "wmz": "application/x-ms-wmz",
0360 "com": "application/x-msdos-program",
0361 "exe": "application/x-msdos-program",
0362 "bat": "application/x-msdos-program",
0363 "dll": "application/x-msdos-program",
0364 "msi": "application/x-msi",
0365 "nc": "application/x-netcdf",
0366 "pac": "application/x-ns-proxy-autoconfig",
0367 "dat": "application/x-ns-proxy-autoconfig",
0368 "nwc": "application/x-nwc",
0369 "o": "application/x-object",
0370 "oza": "application/x-oz-application",
0371 "p7r": "application/x-pkcs7-certreqresp",
0372 "crl": "application/x-pkcs7-crl",
0373 "pyc": "application/x-python-code",
0374 "pyo": "application/x-python-code",
0375 "qgs": "application/x-qgis",
0376 "shp": "application/x-qgis",
0377 "shx": "application/x-qgis",
0378 "qtl": "application/x-quicktimeplayer",
0379 "rdp": "application/x-rdp",
0380 "rpm": "application/x-redhat-package-manager",
0381 "rss": "application/x-rss+xml",
0382 "rb": "application/x-ruby",
0383 "sci": "application/x-scilab",
0384 "sce": "application/x-scilab",
0385 "xcos": "application/x-scilab-xcos",
0386 "sh": "application/x-sh",
0387 "sha1": "application/x-sha1",
0388 "shar": "application/x-shar",
0389 "swf": "application/x-shockwave-flash",
0390 "swfl": "application/x-shockwave-flash",
0391 "scr": "application/x-silverlight",
0392 "sql": "application/x-sql",
0393 "sit": "application/x-stuffit",
0394 "sitx": "application/x-stuffit",
0395 "sv4cpio": "application/x-sv4cpio",
0396 "sv4crc": "application/x-sv4crc",
0397 "tar": "application/x-tar",
0398 "tcl": "application/x-tcl",
0399 "gf": "application/x-tex-gf",
0400 "pk": "application/x-tex-pk",
0401 "texinfo": "application/x-texinfo",
0402 "texi": "application/x-texinfo",
0403 "~": "application/x-trash",
0404 "%": "application/x-trash",
0405 "bak": "application/x-trash",
0406 "old": "application/x-trash",
0407 "sik": "application/x-trash",
0408 "t": "application/x-troff",
0409 "tr": "application/x-troff",
0410 "roff": "application/x-troff",
0411 "man": "application/x-troff-man",
0412 "me": "application/x-troff-me",
0413 "ms": "application/x-troff-ms",
0414 "ustar": "application/x-ustar",
0415 "src": "application/x-wais-source",
0416 "wz": "application/x-wingz",
0417 "crt": "application/x-x509-ca-cert",
0418 "xcf": "application/x-xcf",
0419 "fig": "application/x-xfig",
0420 "xpi": "application/x-xpinstall",
0421 "amr": "audio/amr",
0422 "awb": "audio/amr-wb",
0423 "axa": "audio/annodex",
0424 "au": "audio/basic",
0425 "snd": "audio/basic",
0426 "csd": "audio/csound",
0427 "orc": "audio/csound",
0428 "sco": "audio/csound",
0429 "flac": "audio/flac",
0430 "mid": "audio/midi",
0431 "midi": "audio/midi",
0432 "kar": "audio/midi",
0433 "mpga": "audio/mpeg",
0434 "mpega": "audio/mpeg",
0435 "mp2": "audio/mpeg",
0436 "mp3": "audio/mpeg",
0437 "m4a": "audio/mpeg",
0438 "m3u": "audio/mpegurl",
0439 "oga": "audio/ogg",
0440 "ogg": "audio/ogg",
0441 "opus": "audio/ogg",
0442 "spx": "audio/ogg",
0443 "sid": "audio/prs.sid",
0444 "aif": "audio/x-aiff",
0445 "aiff": "audio/x-aiff",
0446 "aifc": "audio/x-aiff",
0447 "gsm": "audio/x-gsm",
0448 "wma": "audio/x-ms-wma",
0450 "wax": "audio/x-ms-wax",
0451 "ra": "audio/x-pn-realaudio",
0452 "rm": "audio/x-pn-realaudio",
0453 "ram": "audio/x-pn-realaudio",
0454 "pls": "audio/x-scpls",
0456 "sd2": "audio/x-sd2",
0457 "wav": "audio/x-wav",
0458 "alc": "chemical/x-alchemy",
0459 "cac": "chemical/x-cache",
0460 "cache": "chemical/x-cache",
0461 "csf": "chemical/x-cache-csf",
0462 "cbin": "chemical/x-cactvs-binary",
0463 "cascii": "chemical/x-cactvs-binary",
0464 "ctab": "chemical/x-cactvs-binary",
0465 "cdx": "chemical/x-cdx",
0466 "cer": "chemical/x-cerius",
0467 "c3d": "chemical/x-chem3d",
0468 "chm": "chemical/x-chemdraw",
0469 "cif": "chemical/x-cif",
0470 "cmdf": "chemical/x-cmdf",
0471 "cml": "chemical/x-cml",
0472 "cpa": "chemical/x-compass",
0473 "bsd": "chemical/x-crossfire",
0474 "csml": "chemical/x-csml",
0475 "csm": "chemical/x-csml",
0476 "ctx": "chemical/x-ctx",
0477 "cxf": "chemical/x-cxf",
0478 "cef": "chemical/x-cxf",
0479 "emb": "chemical/x-embl-dl-nucleotide",
0480 "embl": "chemical/x-embl-dl-nucleotide",
0481 "spc": "chemical/x-galactic-spc",
0482 "inp": "chemical/x-gamess-input",
0483 "gam": "chemical/x-gamess-input",
0484 "gamin": "chemical/x-gamess-input",
0485 "fch": "chemical/x-gaussian-checkpoint",
0486 "fchk": "chemical/x-gaussian-checkpoint",
0487 "cub": "chemical/x-gaussian-cube",
0488 "gau": "chemical/x-gaussian-input",
0489 "gjc": "chemical/x-gaussian-input",
0490 "gjf": "chemical/x-gaussian-input",
0491 "gal": "chemical/x-gaussian-log",
0492 "gcg": "chemical/x-gcg8-sequence",
0493 "gen": "chemical/x-genbank",
0494 "hin": "chemical/x-hin",
0495 "istr": "chemical/x-isostar",
0496 "ist": "chemical/x-isostar",
0497 "jdx": "chemical/x-jcamp-dx",
0498 "dx": "chemical/x-jcamp-dx",
0499 "kin": "chemical/x-kinemage",
0500 "mcm": "chemical/x-macmolecule",
0501 "mmd": "chemical/x-macromodel-input",
0502 "mmod": "chemical/x-macromodel-input",
0503 "mol": "chemical/x-mdl-molfile",
0504 "rd": "chemical/x-mdl-rdfile",
0505 "rxn": "chemical/x-mdl-rxnfile",
0506 "sd": "chemical/x-mdl-sdfile",
0507 "tgf": "chemical/x-mdl-tgf",
0509 "mcif": "chemical/x-mmcif",
0510 "mol2": "chemical/x-mol2",
0511 "b": "chemical/x-molconn-Z",
0512 "gpt": "chemical/x-mopac-graph",
0513 "mop": "chemical/x-mopac-input",
0514 "mopcrt": "chemical/x-mopac-input",
0515 "mpc": "chemical/x-mopac-input",
0516 "zmt": "chemical/x-mopac-input",
0517 "moo": "chemical/x-mopac-out",
0518 "mvb": "chemical/x-mopac-vib",
0519 "asn": "chemical/x-ncbi-asn1",
0520 "prt": "chemical/x-ncbi-asn1-ascii",
0521 "ent": "chemical/x-ncbi-asn1-ascii",
0522 "val": "chemical/x-ncbi-asn1-binary",
0523 "aso": "chemical/x-ncbi-asn1-binary",
0524 "pdb": "chemical/x-pdb",
0526 "ros": "chemical/x-rosdal",
0528 "sw": "chemical/x-swissprot",
0529 "vms": "chemical/x-vamas-iso14976",
0530 "vmd": "chemical/x-vmd",
0531 "xtel": "chemical/x-xtel",
0532 "xyz": "chemical/x-xyz",
0533 "gif": "image/gif",
0534 "ief": "image/ief",
0535 "jp2": "image/jp2",
0536 "jpg2": "image/jp2",
0537 "jpeg": "image/jpeg",
0538 "jpg": "image/jpeg",
0539 "jpe": "image/jpeg",
0540 "jpm": "image/jpm",
0541 "jpx": "image/jpx",
0542 "jpf": "image/jpx",
0543 "pcx": "image/pcx",
0544 "png": "image/png",
0545 "svg": "image/svg+xml",
0546 "svgz": "image/svg+xml",
0547 "tiff": "image/tiff",
0548 "tif": "image/tiff",
0549 "djvu": "image/vnd.djvu",
0550 "djv": "image/vnd.djvu",
0551 "ico": "image/vnd.microsoft.icon",
0552 "wbmp": "image/vnd.wap.wbmp",
0553 "cr2": "image/x-canon-cr2",
0554 "crw": "image/x-canon-crw",
0555 "ras": "image/x-cmu-raster",
0556 "cdr": "image/x-coreldraw",
0557 "pat": "image/x-coreldrawpattern",
0558 "cdt": "image/x-coreldrawtemplate",
0559 "erf": "image/x-epson-erf",
0561 "art": "image/x-jg",
0562 "jng": "image/x-jng",
0563 "bmp": "image/x-ms-bmp",
0564 "nef": "image/x-nikon-nef",
0565 "orf": "image/x-olympus-orf",
0566 "psd": "image/x-photoshop",
0567 "pnm": "image/x-portable-anymap",
0568 "pbm": "image/x-portable-bitmap",
0569 "pgm": "image/x-portable-graymap",
0570 "ppm": "image/x-portable-pixmap",
0571 "rgb": "image/x-rgb",
0572 "xbm": "image/x-xbitmap",
0573 "xpm": "image/x-xpixmap",
0574 "xwd": "image/x-xwindowdump",
0575 "eml": "message/rfc822",
0576 "igs": "model/iges",
0577 "iges": "model/iges",
0578 "msh": "model/mesh",
0579 "mesh": "model/mesh",
0580 "silo": "model/mesh",
0581 "wrl": "model/vrml",
0582 "vrml": "model/vrml",
0583 "x3dv": "model/x3d+vrml",
0584 "x3d": "model/x3d+xml",
0585 "x3db": "model/x3d+binary",
0586 "appcache": "text/cache-manifest",
0587 "ics": "text/calendar",
0588 "icz": "text/calendar",
0589 "css": "text/css",
0590 "csv": "text/csv",
0591 "323": "text/h323",
0592 "html": "text/html",
0593 "htm": "text/html",
0594 "shtml": "text/html",
0595 "uls": "text/iuls",
0596 "mml": "text/mathml",
0597 "asc": "text/plain",
0598 "txt": "text/plain",
0599 "text": "text/plain",
0600 "pot": "text/plain",
0601 "brf": "text/plain",
0602 "srt": "text/plain",
0603 "rtx": "text/richtext",
0604 "sct": "text/scriptlet",
0605 "wsc": "text/scriptlet",
0606 "tm": "text/texmacs",
0607 "tsv": "text/tab-separated-values",
0608 "ttl": "text/turtle",
0609 "jad": "text/vnd.sun.j2me.app-descriptor",
0610 "wml": "text/vnd.wap.wml",
0611 "wmls": "text/vnd.wap.wmlscript",
0612 "bib": "text/x-bibtex",
0613 "boo": "text/x-boo",
0614 "h++": "text/x-c++hdr",
0615 "hpp": "text/x-c++hdr",
0616 "hxx": "text/x-c++hdr",
0617 "hh": "text/x-c++hdr",
0618 "c++": "text/x-c++src",
0619 "cpp": "text/x-c++src",
0620 "cxx": "text/x-c++src",
0621 "cc": "text/x-c++src",
0622 "h": "text/x-chdr",
0623 "htc": "text/x-component",
0624 "c": "text/x-csrc",
0626 "d": "text/x-dsrc",
0627 "diff": "text/x-diff",
0628 "patch": "text/x-diff",
0629 "hs": "text/x-haskell",
0630 "java": "text/x-java",
0631 "ly": "text/x-lilypond",
0632 "lhs": "text/x-literate-haskell",
0633 "moc": "text/x-moc",
0634 "p": "text/x-pascal",
0635 "pas": "text/x-pascal",
0636 "gcd": "text/x-pcs-gcd",
0637 "pl": "text/x-perl",
0638 "pm": "text/x-perl",
0639 "py": "text/x-python",
0640 "scala": "text/x-scala",
0641 "etx": "text/x-setext",
0642 "sfv": "text/x-sfv",
0643 "tk": "text/x-tcl",
0646 "tex": "text/x-tex",
0647 "ltx": "text/x-tex",
0648 "sty": "text/x-tex",
0649 "cls": "text/x-tex",
0650 "vcs": "text/x-vcalendar",
0651 "vcf": "text/x-vcard",
0652 "3gp": "video/3gpp",
0653 "axv": "video/annodex",
0654 "dl": "video/dl",
0655 "dif": "video/dv",
0656 "dv": "video/dv",
0657 "fli": "video/fli",
0658 "gl": "video/gl",
0659 "mpeg": "video/mpeg",
0660 "mpg": "video/mpeg",
0661 "mpe": "video/mpeg",
0662 "ts": "video/MP2T",
0663 "mp4": "video/mp4",
0664 "qt": "video/quicktime",
0665 "mov": "video/quicktime",
0666 "ogv": "video/ogg",
0667 "webm": "video/webm",
0668 "mxu": "video/vnd.mpegurl",
0669 "flv": "video/x-flv",
0670 "lsf": "video/x-la-asf",
0671 "lsx": "video/x-la-asf",
0672 "mng": "video/x-mng",
0673 "asf": "video/x-ms-asf",
0674 "asx": "video/x-ms-asf",
0675 "wm": "video/x-ms-wm",
0676 "wmv": "video/x-ms-wmv",
0677 "wmx": "video/x-ms-wmx",
0678 "wvx": "video/x-ms-wvx",
0679 "avi": "video/x-msvideo",
0680 "movie": "video/x-sgi-movie",
0681 "mpv": "video/x-matroska",
0682 "mkv": "video/x-matroska",
0683 "ice": "x-conference/x-cooltalk",
0684 "sisx": "x-epoc/x-sisx-app",
0685 "vrm": "x-world/x-vrml",
0686 ]
0689
0690
0691 public func mediaTypeForFileExtension(fileExtension: String) -> MediaType? {
0692 guard let mime = fileExtensionMediaTypeMapping[fileExtension] else {
0693 return nil
0694 }
0695 return MediaType(string: mime)
0696 }