mime-types-lite 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +8 -0
  2. package/index.js +191 -0
  3. package/package.json +24 -0
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # mime-types-lite
2
+
3
+ A collection of commonly used MIME types for applications. This package helps standardize MIME type handling in your project.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install mime-types-lite
package/index.js ADDED
@@ -0,0 +1,191 @@
1
+ /**
2
+ * @fileoverview Defines the various MIME types used in the application.
3
+ * This module exports an object that contains the different MIME types
4
+ * the application can handle. These MIME types are used to identify the format of data being processed or served.
5
+ *
6
+ * @module constants/mimeTypes
7
+ * @version 1.0.0
8
+ * @license CC BY-NC-ND 4.0
9
+ *
10
+ * @contact Mohammad Montasim-Al-Mamun Shuvo
11
+ * @created 2025-01-28
12
+ * @contactEmail montasimmamun@gmail.com
13
+ * @contactGithub https://github.com/montasim
14
+ */
15
+
16
+ /**
17
+ * An object representing different MIME types.
18
+ * @enum {string}
19
+ */
20
+ const mimeTypesConstants = Object.freeze({
21
+ /** Document MIME Types */
22
+
23
+ /**
24
+ * MIME Type for PDF files.
25
+ * Example: The application generates an invoice as a `.pdf` file for download.
26
+ * @type {string}
27
+ */
28
+ PDF: 'application/pdf',
29
+
30
+ /**
31
+ * MIME Type for Markdown files.
32
+ * Example: Documentation files are stored and processed as `.md`.
33
+ * @type {string}
34
+ */
35
+ MD: 'text/markdown',
36
+
37
+ /**
38
+ * MIME Type for Plain Text files.
39
+ * Example: A log file is served as a `.txt` file.
40
+ * @type {string}
41
+ */
42
+ TXT: 'text/plain',
43
+
44
+ /**
45
+ * MIME Type for CSV files.
46
+ * Example: Exported reports are downloaded as `.csv` files.
47
+ * @type {string}
48
+ */
49
+ CSV: 'text/csv',
50
+
51
+
52
+
53
+ /** Image MIME Types */
54
+
55
+ /**
56
+ * MIME Type for JPEG images.
57
+ * Example: User profile pictures are uploaded and served as `.jpeg` images.
58
+ * @type {string}
59
+ */
60
+ JPG: 'image/jpeg',
61
+
62
+ /**
63
+ * MIME Type for PNG images.
64
+ * Example: A server serves `.png` files for website logos.
65
+ * @type {string}
66
+ */
67
+ PNG: 'image/png',
68
+
69
+ /**
70
+ * MIME Type for ICO images.
71
+ * Example: A server provides a `.ico` file as the favicon for a website.
72
+ * @type {string}
73
+ */
74
+ ICO: 'image/x-icon',
75
+
76
+ /**
77
+ * MIME Type for GIF images.
78
+ * Example: A messaging app serves `.gif` files for animated stickers.
79
+ * @type {string}
80
+ */
81
+ GIF: 'image/gif',
82
+
83
+ /**
84
+ * MIME Type for BMP images.
85
+ * Example: Specialized imaging software processes `.bmp` files.
86
+ * @type {string}
87
+ */
88
+ BMP: 'image/bmp',
89
+
90
+ /**
91
+ * MIME Type for TIFF images.
92
+ * Example: High-quality scanned documents are stored as `.tiff` files.
93
+ * @type {string}
94
+ */
95
+ TIFF: 'image/tiff',
96
+
97
+ /**
98
+ * MIME Type for SVG images.
99
+ * Example: A website serves `.svg` files for scalable vector icons.
100
+ * @type {string}
101
+ */
102
+ SVG: 'image/svg+xml',
103
+
104
+
105
+
106
+ /** Video MIME Types */
107
+
108
+ /**
109
+ * MIME Type for MP4 videos.
110
+ * Example: Video streaming services serve `.mp4` files for playback.
111
+ * @type {string}
112
+ */
113
+ MP4: 'video/mp4',
114
+
115
+
116
+
117
+ /** Audio MIME Types */
118
+
119
+ /**
120
+ * MIME Type for MP3 audio files.
121
+ * Example: Music streaming services provide `.mp3` files for playback.
122
+ * @type {string}
123
+ */
124
+ MP3: 'audio/mpeg',
125
+
126
+ /**
127
+ * MIME Type for WAV audio files.
128
+ * Example: A sound editing application processes `.wav` files.
129
+ * @type {string}
130
+ */
131
+ WAV: 'audio/wav',
132
+
133
+
134
+
135
+ /** Archive MIME Types */
136
+
137
+ /**
138
+ * MIME Type for ZIP archives.
139
+ * Example: A server offers `.zip` archives for software downloads.
140
+ * @type {string}
141
+ */
142
+ ZIP: 'application/zip',
143
+
144
+ /**
145
+ * MIME Type for RAR archives.
146
+ * Example: Compressed files are provided in `.rar` format for download.
147
+ * @type {string}
148
+ */
149
+ RAR: 'application/vnd.rar',
150
+
151
+
152
+
153
+ /** Web-related MIME Types */
154
+
155
+ /**
156
+ * MIME Type for JSON data.
157
+ * Example: REST APIs send data responses as JSON objects.
158
+ * @type {string}
159
+ */
160
+ JSON: 'application/json',
161
+
162
+ /**
163
+ * MIME Type for XML data.
164
+ * Example: SOAP APIs exchange data using `.xml` payloads.
165
+ * @type {string}
166
+ */
167
+ XML: 'application/xml',
168
+
169
+ /**
170
+ * MIME Type for JavaScript files.
171
+ * Example: A server delivers a `.js` file requested by a web browser.
172
+ * @type {string}
173
+ */
174
+ JS: 'application/javascript',
175
+
176
+ /**
177
+ * MIME Type for CSS files.
178
+ * Example: A server serves `.css` files to style a web page.
179
+ * @type {string}
180
+ */
181
+ CSS: 'text/css',
182
+
183
+ /**
184
+ * MIME Type for HTML files.
185
+ * Example: A server sends an `.html` file as a response to a browser request.
186
+ * @type {string}
187
+ */
188
+ HTML: 'text/html',
189
+ });
190
+
191
+ export default mimeTypesConstants;
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "mime-types-lite",
3
+ "version": "1.0.0",
4
+ "description": "A collection of common MIME types for use in applications.",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "keywords": ["MIME types", "constants", "MIME", "file types"],
8
+ "author": "Mohammad Montasim-Al-Mamun Shuvo",
9
+ "license": "CC BY-NC-ND 4.0",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/montasim/mime-types-lite.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/montasim/mime-types-lite/issues"
16
+ },
17
+ "homepage": "https://github.com/montasim/mime-types-lite",
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "scripts": {
22
+ "test": "echo \"Error: no test specified\" && exit 1"
23
+ }
24
+ }