aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/net/http/mime.lux
blob: ff449a5685ae26a94ae38ff971459ca826554cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
(.using
 [library
  [lux (.except)
   [data
    ["[0]" text
     ["%" \\format (.only format)]
     ["[0]" encoding (.only Encoding)]]]
   [type
    [primitive (.except)]]]])

(primitive .public MIME
  Text

  (def .public mime
    (-> Text MIME)
    (|>> abstraction))

  (def .public name
    (-> MIME Text)
    (|>> representation))
  )

... https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
(with_template [<name> <type>]
  [(def .public <name> MIME (..mime <type>))]

  [aac_audio "audio/aac"]
  [abiword "application/x-abiword"]
  [avi "video/x-msvideo"]
  [amazon_kindle_ebook "application/vnd.amazon.ebook"]
  [binary "application/octet-stream"]
  [bitmap "image/bmp"]
  [bzip "application/x-bzip"]
  [bzip2 "application/x-bzip2"]
  [c_shell "application/x-csh"]
  [css "text/css"]
  [csv "text/csv"]
  [microsoft_word "application/msword"]
  [microsoft_word_openxml "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]
  [ms_embedded_opentype_fonts "application/vnd.ms-fontobject"]
  [epub "application/epub+zip"]
  [ecmascript "application/ecmascript"]
  [gif "image/gif"]
  [html "text/html"]
  [icon "image/x-icon"]
  [icalendar "text/calendar"]
  [jar "application/java-archive"]
  [jpeg "image/jpeg"]
  [javascript "application/javascript"]
  [json "application/json"]
  [midi "audio/midi"]
  [mpeg "video/mpeg"]
  [apple_installer_package "application/vnd.apple.installer+xml"]
  [opendocument_presentation  "application/vnd.oasis.opendocument.presentation"]
  [opendocument_spreadsheet "application/vnd.oasis.opendocument.spreadsheet"]
  [opendocument_text "application/vnd.oasis.opendocument.text"]
  [ogg_audio "audio/ogg"]
  [ogg_video "video/ogg"]
  [ogg "application/ogg"]
  [opentype_font "font/otf"]
  [png "image/png"]
  [pdf "application/pdf"]
  [microsoft_powerpoint "application/vnd.ms-powerpoint"]
  [microsoft_powerpoint_openxml "application/vnd.openxmlformats-officedocument.presentationml.presentation"]
  [rar "application/x-rar-compressed"]
  [rtf "application/rtf"]
  [bourne_shell "application/x-sh"]
  [svg "image/svg+xml"]
  [flash "application/x-shockwave-flash"]
  [tar "application/x-tar"]
  [tiff "image/tiff"]
  [typescript "application/typescript"]
  [truetype_font "font/ttf"]
  [microsoft_visio "application/vnd.visio"]
  [wav "audio/wav"]
  [webm_audio "audio/webm"]
  [webm_video "video/webm"]
  [webp "image/webp"]
  [woff "font/woff"]
  [woff2 "font/woff2"]
  [xhtml "application/xhtml+xml"]
  [microsoft_excel "application/vnd.ms-excel"]
  [microsoft_excel_openxml "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]
  [xml "application/xml"]
  [xul "application/vnd.mozilla.xul+xml"]
  [zip "application/zip"]
  [!3gpp_audio "audio/3gpp"]
  [!3gpp "video/3gpp"]
  [!3gpp2_audio "audio/3gpp2"]
  [!3gpp2 "video/3gpp2"]
  [!7z "application/x-7z-compressed"]
  )

(def .public (text encoding)
  (-> Encoding MIME)
  (..mime (format "text/plain; charset=" text.double_quote (encoding.name encoding) text.double_quote)))

(def .public utf_8
  MIME
  (..text encoding.utf_8))