-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
167 lines (134 loc) · 5.46 KB
/
index.d.ts
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
type GenericType = 'image' | 'audio' | 'video' | 'font' | 'text' | 'application';
export interface GetMimetypeOutputOK {
status: true,
filepath: string,
mimetype: string
}
export interface GetMimetypeOutputKO {
status: false,
filepath: string,
mimetype: string
}
export type GetMimetypeOutput = GetMimetypeOutputOK | GetMimetypeOutputKO;
export interface IsGenericTypeOutputKO {
status: false,
filepath: string | undefined,
mimetype?: string,
failed: GenericType,
msg: string
}
export type IsGenericTypeOutputOK = GetMimetypeOutputOK;
export type IsGenericTypeOutput = IsGenericTypeOutputOK | IsGenericTypeOutputKO;
export interface IsTypeOutputKO {
status: false,
filepath: string | undefined,
mimetype?: string,
failed: string[],
msg: string
}
export type IsTypeOutputOK = GetMimetypeOutputOK;
export type IsTypeOutput = IsTypeOutputOK | IsTypeOutputKO;
export declare class OMimetype {
constructor()
/* region fns default */
getFromFilepath( filepath: string | undefined ): Promise<GetMimetypeOutput>
isType( filepath: string | undefined, type: string | undefined ): Promise<IsTypeOutput>
isTypes( filepath: string | undefined, type: string[] | undefined ): Promise<IsTypeOutput>
/* endregion */
/* region fns static */
static GetFromFilepath( filepath: string | undefined ): Promise<GetMimetypeOutput>
static IsType( filepath: string | undefined, type: string | undefined ): Promise<IsTypeOutput>
static IsTypes( filepath: string | undefined, type: string[] | undefined ): Promise<IsTypeOutput>
/* */
static IsImage( filepath: string | undefined ): Promise<IsGenericTypeOutput>
static IsAudio( filepath: string | undefined ): Promise<IsGenericTypeOutput>
static IsVideo( filepath: string | undefined ): Promise<IsGenericTypeOutput>
static IsFont( filepath: string | undefined ): Promise<IsGenericTypeOutput>
static IsPdf( filepath: string | undefined ): Promise<IsTypeOutput>
static IsPng( filepath: string | undefined ): Promise<IsTypeOutput>
static IsJpg( filepath: string | undefined ): Promise<IsTypeOutput>
static IsJson( filepath: string | undefined ): Promise<IsTypeOutput>
static IsXml( filepath: string | undefined ): Promise<IsTypeOutput>
/* endregion */
/* region TYPES */
static TYPES: {
AAC : 'audio/aac',
ABW : 'application/x-abiword',
ARC : 'application/x-freearc',
AVIF : 'image/avif',
AVI : 'video/x-msvideo',
AZW : 'application/vnd.amazon.ebook',
BIN : 'application/octet-stream',
BMP : 'image/bmp',
BZ : 'application/x-bzip',
BZ2 : 'application/x-bzip2',
CDA : 'application/x-cdf',
CSH : 'application/x-csh',
CSS : 'text/css',
CSV : 'text/csv',
DOC : 'application/msword',
DOCX : 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
EOT : 'application/vnd.ms-fontobject',
EPUB : 'application/epub+zip',
GZ : 'application/gzip',
GIF : 'image/gif',
HTM : 'text/html',
HTML : 'text/html',
ICO : 'image/vnd.microsoft.icon',
ICS : 'text/calendar',
JAR : 'application/java-archive',
JPEG : 'image/jpeg',
JPG : 'image/jpeg',
JS : 'text/javascript',
JSON : 'application/json',
JSONLD : 'application/ld+json',
MID : 'audio/midi',
MIDI : 'audio/x-midi',
MJS : 'text/javascript',
MP3 : 'audio/mpeg',
MP4 : 'video/mp4',
MPEG : 'video/mpeg',
MPKG : 'application/vnd.apple.installer+xml',
ODP : 'application/vnd.oasis.opendocument.presentation',
ODS : 'application/vnd.oasis.opendocument.spreadsheet',
ODT : 'application/vnd.oasis.opendocument.text',
OGA : 'audio/ogg',
OGV : 'video/ogg',
OGX : 'application/ogg',
OPUS : 'audio/opus',
OTF : 'font/otf',
PNG : 'image/png',
PDF : 'application/pdf',
PHP : 'application/x-httpd-php',
PPT : 'application/vnd.ms-powerpoint',
PPTX : 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
RAR : 'application/vnd.rar',
RTF : 'application/rtf',
SH : 'application/x-sh',
SVG : 'image/svg+xml',
TAR : 'application/x-tar',
TIF : 'image/tiff',
TIFF : 'image/tiff',
TS : 'video/mp2t',
TTF : 'font/ttf',
TXT : 'text/plain',
VSD : 'application/vnd.visio',
WAV : 'audio/wav',
WEBA : 'audio/webm',
WEBM : 'video/webm',
WEBP : 'image/webp',
WOFF : 'font/woff',
WOFF2 : 'font/woff2',
XHTML : 'application/xhtml+xml',
XLS : 'application/vnd.ms-excel',
XLSX : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
XML : 'application/xml',
XML_TEXT : 'text/xml',
XML_ATOM : 'application/atom+xml',
XUL : 'application/vnd.mozilla.xul+xml',
ZIP : 'application/zip',
'7Z' : 'application/x-7z-compressed',
}
/* endregion */
}
export default OMimetype;