Skip to content

Commit

Permalink
Updated MIME types
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 19, 2023
1 parent 85454af commit 471731a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
"application/pdf": [ "pdf" ],
"application/rtf": [ "rtf" ],
"application/tar": [ "tar" ],
"application/tar+gzip": [
"tar.gz",
"tgz"
],
"application/tar+gzip": [ "tgz" ],
"application/typescript": [
"ts",
"mts"
Expand Down
5 changes: 3 additions & 2 deletions src/mime_types/get_mime_type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import MIMETypesFile from './mime_types.json' assert { type: 'json' }
import MIMETypesFile from './default_mime_types.json' assert { type: 'json' }
import { MIMETypesObject } from "./mime_type_object.d.ts";

export function getMIMEType(extension : string) : string {
export function getMIMEType(mIMETypesObject : MIMETypesObject, extension : string) : string {
const MIMETypesMap = Object.entries(MIMETypesFile.types).reduce((
map,
[
Expand Down
11 changes: 11 additions & 0 deletions src/mime_types/mime_type_object.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* This interface represents a MIME types object
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)
*/
export interface MIMETypesObject {
/** Default MIME type */
default : string,
/** List of MIME types consisting of MIME type key and an array of file extensions */
types : Record<string, string[]>
}

0 comments on commit 471731a

Please sign in to comment.