Skip to content

Commit

Permalink
refactor(utils/mime): make object and type commonality (#3606)
Browse files Browse the repository at this point in the history
* refactor(utils/mime): make object and type commonality

* change to <string, BaseMime>
  • Loading branch information
EdamAme-x authored Nov 2, 2024
1 parent f3577a1 commit 3aad86c
Showing 1 changed file with 5 additions and 52 deletions.
57 changes: 5 additions & 52 deletions src/utils/mime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,58 +32,9 @@ export { baseMimes as mimes }
/**
* Union types for BaseMime
*/
export type BaseMime =
| 'audio/aac'
| 'video/x-msvideo'
| 'image/avif'
| 'video/av1'
| 'application/octet-stream'
| 'image/bmp'
| 'text/css'
| 'text/csv'
| 'application/vnd.ms-fontobject'
| 'application/epub+zip'
| 'image/gif'
| 'application/gzip'
| 'text/html'
| 'image/x-icon'
| 'text/calendar'
| 'image/jpeg'
| 'text/javascript'
| 'application/json'
| 'application/ld+json'
| 'audio/x-midi'
| 'audio/mpeg'
| 'video/mp4'
| 'video/mpeg'
| 'audio/ogg'
| 'video/ogg'
| 'application/ogg'
| 'audio/opus'
| 'font/otf'
| 'application/pdf'
| 'image/png'
| 'application/rtf'
| 'image/svg+xml'
| 'image/tiff'
| 'video/mp2t'
| 'font/ttf'
| 'text/plain'
| 'application/wasm'
| 'video/webm'
| 'audio/webm'
| 'image/webp'
| 'font/woff'
| 'font/woff2'
| 'application/xhtml+xml'
| 'application/xml'
| 'application/zip'
| 'video/3gpp'
| 'video/3gpp2'
| 'model/gltf+json'
| 'model/gltf-binary'
export type BaseMime = (typeof _baseMimes)[keyof typeof _baseMimes]

const baseMimes: Record<string, BaseMime> = {
const _baseMimes = {
aac: 'audio/aac',
avi: 'video/x-msvideo',
avif: 'image/avif',
Expand Down Expand Up @@ -139,4 +90,6 @@ const baseMimes: Record<string, BaseMime> = {
'3g2': 'video/3gpp2',
gltf: 'model/gltf+json',
glb: 'model/gltf-binary',
}
} as const

const baseMimes: Record<string, BaseMime> = _baseMimes

0 comments on commit 3aad86c

Please sign in to comment.