-
Notifications
You must be signed in to change notification settings - Fork 14
MIMEType
Josh Wright edited this page Jan 14, 2021
·
4 revisions
An HTTP Media Type. It has a value: String
appropriate for
putting into Content-Type
headers.
public struct MIMEType
Create with a string.
public init(_ value: String)
- value: The string of the MIME type.
Creates based off of a known file extension that can be mapped
to an appropriate Content-Type
header value. Returns nil if
no MIME type is known.
public init?(fileExtension: String)
The .
in front of the file extension is optional.
Usage:
let mt = MediaType(fileExtension: "html")!
print(mt.value) // "text/html"
- fileExtension: The file extension to look up a MIME type for.
The value of this MIME type, appropriate for Content-Type
headers.
var value: String
let bmp
let css
let csv
let epub
let gzip
let gif
let html
let calendar
let jpeg
let javascript
let json
let mid
let mp3
let mpeg
let octetStream
let oga
let ogv
let otf
let pdf
let php
let plainText
let png
let rtf
let svg
let tar
let tiff
let ttf
let wav
let xhtml
let xml
let zip
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue