@d0paminedriven/fs 4.1.0 → 6.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.
- package/README.md +105 -0
- package/dist/chunk-7QVYU63E.js +7 -0
- package/dist/chunk-EHOBCDHE.js +161 -0
- package/dist/chunk-KZWE4E4I.js +328 -0
- package/dist/chunk-QMN5ZCE4.js +131 -0
- package/dist/chunk-XHN56MDK.js +30 -0
- package/dist/fs/index.cjs +207 -493
- package/dist/fs/index.d.cts +14 -382
- package/dist/fs/index.d.ts +14 -382
- package/dist/fs/index.js +4 -2
- package/dist/index.cjs +340 -496
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -7
- package/dist/mime/index.cjs +204 -0
- package/dist/mime/index.d.cts +238 -0
- package/dist/mime/index.d.ts +238 -0
- package/dist/mime/index.js +11 -0
- package/dist/types/index.d.cts +8 -8
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +0 -6
- package/dist/url/index.cjs +51 -0
- package/dist/url/index.d.cts +28 -0
- package/dist/url/index.d.ts +28 -0
- package/dist/url/index.js +8 -0
- package/dist/utils/index.cjs +152 -0
- package/dist/utils/index.d.cts +29 -0
- package/dist/utils/index.d.ts +29 -0
- package/dist/utils/index.js +8 -0
- package/package.json +29 -17
- package/dist/chunk-ELR74GDM.js +0 -774
- package/dist/chunk-I6PDZOED.js +0 -44
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.cjs';
|
|
2
|
+
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, PresentMimeTopLevelTypes, extMimeMap } from './mime/index.cjs';
|
|
2
3
|
export { Abortable, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BufferEncodingUnion, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, InferDepth, InjectScriptsProps, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, ReadDirOptions, ReadDirProps, RemoveFields, RequiredToConditional, RmDirOptions, RmDirProps, Signals, StdioOptions, TypedArray, Unenumerate, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR } from './types/index.cjs';
|
|
4
|
+
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.cjs';
|
|
5
|
+
export { UtilsService } from './utils/index.cjs';
|
|
3
6
|
import 'dotenv-expand';
|
|
4
7
|
import 'sharp';
|
|
5
8
|
import 'stream';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.js';
|
|
2
|
+
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, PresentMimeTopLevelTypes, extMimeMap } from './mime/index.js';
|
|
2
3
|
export { Abortable, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BufferEncodingUnion, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, InferDepth, InjectScriptsProps, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, ReadDirOptions, ReadDirProps, RemoveFields, RequiredToConditional, RmDirOptions, RmDirProps, Signals, StdioOptions, TypedArray, Unenumerate, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR } from './types/index.js';
|
|
4
|
+
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.js';
|
|
5
|
+
export { UtilsService } from './utils/index.js';
|
|
3
6
|
import 'dotenv-expand';
|
|
4
7
|
import 'sharp';
|
|
5
8
|
import 'stream';
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KZWE4E4I.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
MimeService,
|
|
6
|
+
extMimeMap
|
|
7
|
+
} from "./chunk-EHOBCDHE.js";
|
|
8
|
+
import {
|
|
9
|
+
UrlService
|
|
10
|
+
} from "./chunk-XHN56MDK.js";
|
|
11
|
+
import {
|
|
12
|
+
UtilsService
|
|
13
|
+
} from "./chunk-QMN5ZCE4.js";
|
|
14
|
+
import "./chunk-7QVYU63E.js";
|
|
10
15
|
export {
|
|
11
|
-
Fs
|
|
16
|
+
Fs,
|
|
17
|
+
MimeService,
|
|
18
|
+
UrlService,
|
|
19
|
+
UtilsService,
|
|
20
|
+
extMimeMap
|
|
12
21
|
};
|
|
13
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/mime/index.ts
|
|
22
|
+
var mime_exports = {};
|
|
23
|
+
__export(mime_exports, {
|
|
24
|
+
MimeService: () => MimeService,
|
|
25
|
+
extMimeMap: () => extMimeMap
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(mime_exports);
|
|
28
|
+
|
|
29
|
+
// src/url/index.ts
|
|
30
|
+
var UrlService = class {
|
|
31
|
+
static {
|
|
32
|
+
__name(this, "UrlService");
|
|
33
|
+
}
|
|
34
|
+
URL_REGEX = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
|
35
|
+
parseUrl(url) {
|
|
36
|
+
const parsed = this.URL_REGEX.exec(url);
|
|
37
|
+
if (parsed) {
|
|
38
|
+
return {
|
|
39
|
+
href: parsed[0],
|
|
40
|
+
protocol: parsed[1] ?? "",
|
|
41
|
+
baseUrl: `${parsed[1]}${parsed[3]}`,
|
|
42
|
+
host: parsed[4] ?? "",
|
|
43
|
+
pathname: parsed[5] ?? "",
|
|
44
|
+
search: parsed[6] ?? "",
|
|
45
|
+
hash: parsed[8] ?? ""
|
|
46
|
+
};
|
|
47
|
+
} else return null;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/mime/index.ts
|
|
52
|
+
var extMimeMap = {
|
|
53
|
+
aac: ["audio/aac"],
|
|
54
|
+
abw: ["application/x-abiword"],
|
|
55
|
+
aces: ["image/aces"],
|
|
56
|
+
apng: ["image/apng"],
|
|
57
|
+
arc: ["application/x-freearc"],
|
|
58
|
+
avci: ["image/avci"],
|
|
59
|
+
avif: ["image/avif"],
|
|
60
|
+
avi: ["video/x-msvideo"],
|
|
61
|
+
azw: ["application/vnd.amazon.ebook"],
|
|
62
|
+
bin: ["application/octet-stream"],
|
|
63
|
+
bmp: ["image/bmp"],
|
|
64
|
+
bz: ["application/x-bzip"],
|
|
65
|
+
bz2: ["application/x-bzip2"],
|
|
66
|
+
cda: ["application/x-cdf"],
|
|
67
|
+
cjs: ["application/node", "text/javascript"],
|
|
68
|
+
csh: ["application/x-csh"],
|
|
69
|
+
css: ["text/css"],
|
|
70
|
+
csv: ["text/csv"],
|
|
71
|
+
doc: ["application/msword"],
|
|
72
|
+
docx: [
|
|
73
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
74
|
+
],
|
|
75
|
+
dpx: ["image/dpx"],
|
|
76
|
+
emf: ["image/emf"],
|
|
77
|
+
eot: ["application/vnd.ms-fontobject"],
|
|
78
|
+
epub: ["application/epub+zip"],
|
|
79
|
+
gif: ["image/gif"],
|
|
80
|
+
glb: ["model/gltf-binary"],
|
|
81
|
+
gltf: ["model/gltf+json"],
|
|
82
|
+
gz: ["application/x-gzip", "application/gzip"],
|
|
83
|
+
hjif: ["haptics/hjif"],
|
|
84
|
+
hmpg: ["haptics/hmpg"],
|
|
85
|
+
htm: ["text/html"],
|
|
86
|
+
html: ["text/html"],
|
|
87
|
+
ico: ["image/vnd.microsoft.icon"],
|
|
88
|
+
ics: ["text/calendar"],
|
|
89
|
+
ivs: ["haptics/ivs"],
|
|
90
|
+
jar: ["application/java-archive"],
|
|
91
|
+
jpeg: ["image/jpeg"],
|
|
92
|
+
jpg: ["image/jpeg"],
|
|
93
|
+
js: ["application/node", "text/javascript"],
|
|
94
|
+
json: ["application/json"],
|
|
95
|
+
jsonld: ["application/ld+json"],
|
|
96
|
+
ktx: ["image/ktx"],
|
|
97
|
+
ktx2: ["image/ktx2"],
|
|
98
|
+
m3u8: ["application/vnd.apple.mpegurl"],
|
|
99
|
+
m4a: ["audio/mp4"],
|
|
100
|
+
m4v: ["video/mp4"],
|
|
101
|
+
md: ["text/markdown"],
|
|
102
|
+
mdx: ["application/x-mdx"],
|
|
103
|
+
mid: ["audio/midi"],
|
|
104
|
+
midi: ["audio/x-midi"],
|
|
105
|
+
mjs: ["text/javascript"],
|
|
106
|
+
mp3: ["audio/mpeg"],
|
|
107
|
+
mp4: ["video/mp4"],
|
|
108
|
+
mpeg: ["video/mpeg"],
|
|
109
|
+
mpkg: ["application/vnd.apple.installer+xml"],
|
|
110
|
+
ndjson: ["application/x-ndjson"],
|
|
111
|
+
obj: ["application/octet-stream", "text/plain", "model/obj"],
|
|
112
|
+
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
113
|
+
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
114
|
+
odt: ["application/vnd.oasis.opendocument.text"],
|
|
115
|
+
oga: ["audio/ogg"],
|
|
116
|
+
ogg: ["audio/ogg"],
|
|
117
|
+
ogv: ["video/ogg"],
|
|
118
|
+
ogx: ["application/ogg"],
|
|
119
|
+
opus: ["audio/ogg"],
|
|
120
|
+
otf: ["font/otf"],
|
|
121
|
+
png: ["image/png"],
|
|
122
|
+
pdf: ["application/pdf"],
|
|
123
|
+
php: ["application/x-httpd-php"],
|
|
124
|
+
pkpass: ["application/vnd.apple.pkpass"],
|
|
125
|
+
ppt: ["application/vnd.ms-powerpoint"],
|
|
126
|
+
pptx: [
|
|
127
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
128
|
+
],
|
|
129
|
+
py: ["text/x-python"],
|
|
130
|
+
pyc: ["application/x-python-code"],
|
|
131
|
+
rar: ["application/vnd.rar"],
|
|
132
|
+
rtf: ["application/rtf"],
|
|
133
|
+
sh: ["application/x-sh"],
|
|
134
|
+
sql: ["application/sql"],
|
|
135
|
+
svg: ["image/svg+xml"],
|
|
136
|
+
tar: ["application/x-tar"],
|
|
137
|
+
tif: ["image/tiff"],
|
|
138
|
+
tiff: ["image/tiff"],
|
|
139
|
+
toml: ["application/toml"],
|
|
140
|
+
ts: ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"],
|
|
141
|
+
ttf: ["application/font-sfnt", "font/ttf"],
|
|
142
|
+
txt: ["text/plain"],
|
|
143
|
+
usdz: ["model/vnd.usdz+zip"],
|
|
144
|
+
vsd: ["application/vnd.visio"],
|
|
145
|
+
vtt: ["text/vtt"],
|
|
146
|
+
wasm: ["application/wasm"],
|
|
147
|
+
wav: ["audio/wav"],
|
|
148
|
+
weba: ["video/webm"],
|
|
149
|
+
webp: ["image/webp"],
|
|
150
|
+
woff: ["font/woff"],
|
|
151
|
+
woff2: ["font/woff2"],
|
|
152
|
+
xhtml: ["application/xhtml+xml"],
|
|
153
|
+
xls: ["application/vnd.ms-excel"],
|
|
154
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
155
|
+
xml: ["application/xml"],
|
|
156
|
+
xul: ["application/vnd.mozilla.xul+xml"],
|
|
157
|
+
yaml: ["application/yaml"],
|
|
158
|
+
yml: ["application/yaml"],
|
|
159
|
+
zip: ["application/zip", "application/x-zip-compressed"],
|
|
160
|
+
"3gp": ["video/3gpp"],
|
|
161
|
+
"3g2": ["video/3gpp2"],
|
|
162
|
+
"7z": ["application/x-7z-compressed"]
|
|
163
|
+
};
|
|
164
|
+
var MimeService = class extends UrlService {
|
|
165
|
+
static {
|
|
166
|
+
__name(this, "MimeService");
|
|
167
|
+
}
|
|
168
|
+
constructor() {
|
|
169
|
+
super();
|
|
170
|
+
}
|
|
171
|
+
mimeTypeObj = extMimeMap;
|
|
172
|
+
assetType(url) {
|
|
173
|
+
const parsed = this.parseUrl(url);
|
|
174
|
+
if (!parsed) return void 0;
|
|
175
|
+
const ext = parsed.pathname.split(/([.])/g)?.reverse()?.[0]?.toLowerCase();
|
|
176
|
+
return ext && ext in this.mimeTypeObj ? ext : void 0;
|
|
177
|
+
}
|
|
178
|
+
getMimes(ext) {
|
|
179
|
+
return this.mimeTypeObj[ext];
|
|
180
|
+
}
|
|
181
|
+
getMimeFor(ext, opts) {
|
|
182
|
+
const mimes = this.getMimes(ext);
|
|
183
|
+
if (mimes.length === 1) return mimes[0];
|
|
184
|
+
if (opts?.type) {
|
|
185
|
+
const found = mimes.find((mime) => mime.startsWith(opts.type + "/"));
|
|
186
|
+
return found ?? mimes[0];
|
|
187
|
+
}
|
|
188
|
+
return mimes[0];
|
|
189
|
+
}
|
|
190
|
+
isMimeFor(ext, mime) {
|
|
191
|
+
return this.getMimes(ext).find((s) => s === mime);
|
|
192
|
+
}
|
|
193
|
+
getMimeTypeForPath(path, opts) {
|
|
194
|
+
const ext = this.assetType(path);
|
|
195
|
+
if (!ext) return "application/octet-stream";
|
|
196
|
+
return this.getMimeFor(ext, opts);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
200
|
+
0 && (module.exports = {
|
|
201
|
+
MimeService,
|
|
202
|
+
extMimeMap
|
|
203
|
+
});
|
|
204
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { UrlService } from '../url/index.cjs';
|
|
2
|
+
|
|
3
|
+
declare const extMimeMap: {
|
|
4
|
+
readonly aac: readonly ["audio/aac"];
|
|
5
|
+
readonly abw: readonly ["application/x-abiword"];
|
|
6
|
+
readonly aces: readonly ["image/aces"];
|
|
7
|
+
readonly apng: readonly ["image/apng"];
|
|
8
|
+
readonly arc: readonly ["application/x-freearc"];
|
|
9
|
+
readonly avci: readonly ["image/avci"];
|
|
10
|
+
readonly avif: readonly ["image/avif"];
|
|
11
|
+
readonly avi: readonly ["video/x-msvideo"];
|
|
12
|
+
readonly azw: readonly ["application/vnd.amazon.ebook"];
|
|
13
|
+
readonly bin: readonly ["application/octet-stream"];
|
|
14
|
+
readonly bmp: readonly ["image/bmp"];
|
|
15
|
+
readonly bz: readonly ["application/x-bzip"];
|
|
16
|
+
readonly bz2: readonly ["application/x-bzip2"];
|
|
17
|
+
readonly cda: readonly ["application/x-cdf"];
|
|
18
|
+
readonly cjs: readonly ["application/node", "text/javascript"];
|
|
19
|
+
readonly csh: readonly ["application/x-csh"];
|
|
20
|
+
readonly css: readonly ["text/css"];
|
|
21
|
+
readonly csv: readonly ["text/csv"];
|
|
22
|
+
readonly doc: readonly ["application/msword"];
|
|
23
|
+
readonly docx: readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"];
|
|
24
|
+
readonly dpx: readonly ["image/dpx"];
|
|
25
|
+
readonly emf: readonly ["image/emf"];
|
|
26
|
+
readonly eot: readonly ["application/vnd.ms-fontobject"];
|
|
27
|
+
readonly epub: readonly ["application/epub+zip"];
|
|
28
|
+
readonly gif: readonly ["image/gif"];
|
|
29
|
+
readonly glb: readonly ["model/gltf-binary"];
|
|
30
|
+
readonly gltf: readonly ["model/gltf+json"];
|
|
31
|
+
readonly gz: readonly ["application/x-gzip", "application/gzip"];
|
|
32
|
+
readonly hjif: readonly ["haptics/hjif"];
|
|
33
|
+
readonly hmpg: readonly ["haptics/hmpg"];
|
|
34
|
+
readonly htm: readonly ["text/html"];
|
|
35
|
+
readonly html: readonly ["text/html"];
|
|
36
|
+
readonly ico: readonly ["image/vnd.microsoft.icon"];
|
|
37
|
+
readonly ics: readonly ["text/calendar"];
|
|
38
|
+
readonly ivs: readonly ["haptics/ivs"];
|
|
39
|
+
readonly jar: readonly ["application/java-archive"];
|
|
40
|
+
readonly jpeg: readonly ["image/jpeg"];
|
|
41
|
+
readonly jpg: readonly ["image/jpeg"];
|
|
42
|
+
readonly js: readonly ["application/node", "text/javascript"];
|
|
43
|
+
readonly json: readonly ["application/json"];
|
|
44
|
+
readonly jsonld: readonly ["application/ld+json"];
|
|
45
|
+
readonly ktx: readonly ["image/ktx"];
|
|
46
|
+
readonly ktx2: readonly ["image/ktx2"];
|
|
47
|
+
readonly m3u8: readonly ["application/vnd.apple.mpegurl"];
|
|
48
|
+
readonly m4a: readonly ["audio/mp4"];
|
|
49
|
+
readonly m4v: readonly ["video/mp4"];
|
|
50
|
+
readonly md: readonly ["text/markdown"];
|
|
51
|
+
readonly mdx: readonly ["application/x-mdx"];
|
|
52
|
+
readonly mid: readonly ["audio/midi"];
|
|
53
|
+
readonly midi: readonly ["audio/x-midi"];
|
|
54
|
+
readonly mjs: readonly ["text/javascript"];
|
|
55
|
+
readonly mp3: readonly ["audio/mpeg"];
|
|
56
|
+
readonly mp4: readonly ["video/mp4"];
|
|
57
|
+
readonly mpeg: readonly ["video/mpeg"];
|
|
58
|
+
readonly mpkg: readonly ["application/vnd.apple.installer+xml"];
|
|
59
|
+
readonly ndjson: readonly ["application/x-ndjson"];
|
|
60
|
+
readonly obj: readonly ["application/octet-stream", "text/plain", "model/obj"];
|
|
61
|
+
readonly odp: readonly ["application/vnd.oasis.opendocument.presentation"];
|
|
62
|
+
readonly ods: readonly ["application/vnd.oasis.opendocument.spreadsheet"];
|
|
63
|
+
readonly odt: readonly ["application/vnd.oasis.opendocument.text"];
|
|
64
|
+
readonly oga: readonly ["audio/ogg"];
|
|
65
|
+
readonly ogg: readonly ["audio/ogg"];
|
|
66
|
+
readonly ogv: readonly ["video/ogg"];
|
|
67
|
+
readonly ogx: readonly ["application/ogg"];
|
|
68
|
+
readonly opus: readonly ["audio/ogg"];
|
|
69
|
+
readonly otf: readonly ["font/otf"];
|
|
70
|
+
readonly png: readonly ["image/png"];
|
|
71
|
+
readonly pdf: readonly ["application/pdf"];
|
|
72
|
+
readonly php: readonly ["application/x-httpd-php"];
|
|
73
|
+
readonly pkpass: readonly ["application/vnd.apple.pkpass"];
|
|
74
|
+
readonly ppt: readonly ["application/vnd.ms-powerpoint"];
|
|
75
|
+
readonly pptx: readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"];
|
|
76
|
+
readonly py: readonly ["text/x-python"];
|
|
77
|
+
readonly pyc: readonly ["application/x-python-code"];
|
|
78
|
+
readonly rar: readonly ["application/vnd.rar"];
|
|
79
|
+
readonly rtf: readonly ["application/rtf"];
|
|
80
|
+
readonly sh: readonly ["application/x-sh"];
|
|
81
|
+
readonly sql: readonly ["application/sql"];
|
|
82
|
+
readonly svg: readonly ["image/svg+xml"];
|
|
83
|
+
readonly tar: readonly ["application/x-tar"];
|
|
84
|
+
readonly tif: readonly ["image/tiff"];
|
|
85
|
+
readonly tiff: readonly ["image/tiff"];
|
|
86
|
+
readonly toml: readonly ["application/toml"];
|
|
87
|
+
readonly ts: readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"];
|
|
88
|
+
readonly ttf: readonly ["application/font-sfnt", "font/ttf"];
|
|
89
|
+
readonly txt: readonly ["text/plain"];
|
|
90
|
+
readonly usdz: readonly ["model/vnd.usdz+zip"];
|
|
91
|
+
readonly vsd: readonly ["application/vnd.visio"];
|
|
92
|
+
readonly vtt: readonly ["text/vtt"];
|
|
93
|
+
readonly wasm: readonly ["application/wasm"];
|
|
94
|
+
readonly wav: readonly ["audio/wav"];
|
|
95
|
+
readonly weba: readonly ["video/webm"];
|
|
96
|
+
readonly webp: readonly ["image/webp"];
|
|
97
|
+
readonly woff: readonly ["font/woff"];
|
|
98
|
+
readonly woff2: readonly ["font/woff2"];
|
|
99
|
+
readonly xhtml: readonly ["application/xhtml+xml"];
|
|
100
|
+
readonly xls: readonly ["application/vnd.ms-excel"];
|
|
101
|
+
readonly xlsx: readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];
|
|
102
|
+
readonly xml: readonly ["application/xml"];
|
|
103
|
+
readonly xul: readonly ["application/vnd.mozilla.xul+xml"];
|
|
104
|
+
readonly yaml: readonly ["application/yaml"];
|
|
105
|
+
readonly yml: readonly ["application/yaml"];
|
|
106
|
+
readonly zip: readonly ["application/zip", "application/x-zip-compressed"];
|
|
107
|
+
readonly "3gp": readonly ["video/3gpp"];
|
|
108
|
+
readonly "3g2": readonly ["video/3gpp2"];
|
|
109
|
+
readonly "7z": readonly ["application/x-7z-compressed"];
|
|
110
|
+
};
|
|
111
|
+
type FileExtension = keyof typeof extMimeMap;
|
|
112
|
+
type FileExtensionToMimeType<T extends FileExtension> = (typeof extMimeMap)[T][number];
|
|
113
|
+
type AllMimeTypes = FileExtensionToMimeType<FileExtension>;
|
|
114
|
+
type InferTopLevelPresent<T> = T extends `${infer U}/${string}` ? U : T;
|
|
115
|
+
type PresentMimeTopLevelTypes = InferTopLevelPresent<AllMimeTypes>;
|
|
116
|
+
type MimeTopLevelType = "text" | "haptics" | "multipart" | "image" | "font" | "video" | "audio" | "application" | "model" | "message" | "example";
|
|
117
|
+
declare class MimeService extends UrlService {
|
|
118
|
+
constructor();
|
|
119
|
+
readonly mimeTypeObj: {
|
|
120
|
+
readonly aac: readonly ["audio/aac"];
|
|
121
|
+
readonly abw: readonly ["application/x-abiword"];
|
|
122
|
+
readonly aces: readonly ["image/aces"];
|
|
123
|
+
readonly apng: readonly ["image/apng"];
|
|
124
|
+
readonly arc: readonly ["application/x-freearc"];
|
|
125
|
+
readonly avci: readonly ["image/avci"];
|
|
126
|
+
readonly avif: readonly ["image/avif"];
|
|
127
|
+
readonly avi: readonly ["video/x-msvideo"];
|
|
128
|
+
readonly azw: readonly ["application/vnd.amazon.ebook"];
|
|
129
|
+
readonly bin: readonly ["application/octet-stream"];
|
|
130
|
+
readonly bmp: readonly ["image/bmp"];
|
|
131
|
+
readonly bz: readonly ["application/x-bzip"];
|
|
132
|
+
readonly bz2: readonly ["application/x-bzip2"];
|
|
133
|
+
readonly cda: readonly ["application/x-cdf"];
|
|
134
|
+
readonly cjs: readonly ["application/node", "text/javascript"];
|
|
135
|
+
readonly csh: readonly ["application/x-csh"];
|
|
136
|
+
readonly css: readonly ["text/css"];
|
|
137
|
+
readonly csv: readonly ["text/csv"];
|
|
138
|
+
readonly doc: readonly ["application/msword"];
|
|
139
|
+
readonly docx: readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"];
|
|
140
|
+
readonly dpx: readonly ["image/dpx"];
|
|
141
|
+
readonly emf: readonly ["image/emf"];
|
|
142
|
+
readonly eot: readonly ["application/vnd.ms-fontobject"];
|
|
143
|
+
readonly epub: readonly ["application/epub+zip"];
|
|
144
|
+
readonly gif: readonly ["image/gif"];
|
|
145
|
+
readonly glb: readonly ["model/gltf-binary"];
|
|
146
|
+
readonly gltf: readonly ["model/gltf+json"];
|
|
147
|
+
readonly gz: readonly ["application/x-gzip", "application/gzip"];
|
|
148
|
+
readonly hjif: readonly ["haptics/hjif"];
|
|
149
|
+
readonly hmpg: readonly ["haptics/hmpg"];
|
|
150
|
+
readonly htm: readonly ["text/html"];
|
|
151
|
+
readonly html: readonly ["text/html"];
|
|
152
|
+
readonly ico: readonly ["image/vnd.microsoft.icon"];
|
|
153
|
+
readonly ics: readonly ["text/calendar"];
|
|
154
|
+
readonly ivs: readonly ["haptics/ivs"];
|
|
155
|
+
readonly jar: readonly ["application/java-archive"];
|
|
156
|
+
readonly jpeg: readonly ["image/jpeg"];
|
|
157
|
+
readonly jpg: readonly ["image/jpeg"];
|
|
158
|
+
readonly js: readonly ["application/node", "text/javascript"];
|
|
159
|
+
readonly json: readonly ["application/json"];
|
|
160
|
+
readonly jsonld: readonly ["application/ld+json"];
|
|
161
|
+
readonly ktx: readonly ["image/ktx"];
|
|
162
|
+
readonly ktx2: readonly ["image/ktx2"];
|
|
163
|
+
readonly m3u8: readonly ["application/vnd.apple.mpegurl"];
|
|
164
|
+
readonly m4a: readonly ["audio/mp4"];
|
|
165
|
+
readonly m4v: readonly ["video/mp4"];
|
|
166
|
+
readonly md: readonly ["text/markdown"];
|
|
167
|
+
readonly mdx: readonly ["application/x-mdx"];
|
|
168
|
+
readonly mid: readonly ["audio/midi"];
|
|
169
|
+
readonly midi: readonly ["audio/x-midi"];
|
|
170
|
+
readonly mjs: readonly ["text/javascript"];
|
|
171
|
+
readonly mp3: readonly ["audio/mpeg"];
|
|
172
|
+
readonly mp4: readonly ["video/mp4"];
|
|
173
|
+
readonly mpeg: readonly ["video/mpeg"];
|
|
174
|
+
readonly mpkg: readonly ["application/vnd.apple.installer+xml"];
|
|
175
|
+
readonly ndjson: readonly ["application/x-ndjson"];
|
|
176
|
+
readonly obj: readonly ["application/octet-stream", "text/plain", "model/obj"];
|
|
177
|
+
readonly odp: readonly ["application/vnd.oasis.opendocument.presentation"];
|
|
178
|
+
readonly ods: readonly ["application/vnd.oasis.opendocument.spreadsheet"];
|
|
179
|
+
readonly odt: readonly ["application/vnd.oasis.opendocument.text"];
|
|
180
|
+
readonly oga: readonly ["audio/ogg"];
|
|
181
|
+
readonly ogg: readonly ["audio/ogg"];
|
|
182
|
+
readonly ogv: readonly ["video/ogg"];
|
|
183
|
+
readonly ogx: readonly ["application/ogg"];
|
|
184
|
+
readonly opus: readonly ["audio/ogg"];
|
|
185
|
+
readonly otf: readonly ["font/otf"];
|
|
186
|
+
readonly png: readonly ["image/png"];
|
|
187
|
+
readonly pdf: readonly ["application/pdf"];
|
|
188
|
+
readonly php: readonly ["application/x-httpd-php"];
|
|
189
|
+
readonly pkpass: readonly ["application/vnd.apple.pkpass"];
|
|
190
|
+
readonly ppt: readonly ["application/vnd.ms-powerpoint"];
|
|
191
|
+
readonly pptx: readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"];
|
|
192
|
+
readonly py: readonly ["text/x-python"];
|
|
193
|
+
readonly pyc: readonly ["application/x-python-code"];
|
|
194
|
+
readonly rar: readonly ["application/vnd.rar"];
|
|
195
|
+
readonly rtf: readonly ["application/rtf"];
|
|
196
|
+
readonly sh: readonly ["application/x-sh"];
|
|
197
|
+
readonly sql: readonly ["application/sql"];
|
|
198
|
+
readonly svg: readonly ["image/svg+xml"];
|
|
199
|
+
readonly tar: readonly ["application/x-tar"];
|
|
200
|
+
readonly tif: readonly ["image/tiff"];
|
|
201
|
+
readonly tiff: readonly ["image/tiff"];
|
|
202
|
+
readonly toml: readonly ["application/toml"];
|
|
203
|
+
readonly ts: readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"];
|
|
204
|
+
readonly ttf: readonly ["application/font-sfnt", "font/ttf"];
|
|
205
|
+
readonly txt: readonly ["text/plain"];
|
|
206
|
+
readonly usdz: readonly ["model/vnd.usdz+zip"];
|
|
207
|
+
readonly vsd: readonly ["application/vnd.visio"];
|
|
208
|
+
readonly vtt: readonly ["text/vtt"];
|
|
209
|
+
readonly wasm: readonly ["application/wasm"];
|
|
210
|
+
readonly wav: readonly ["audio/wav"];
|
|
211
|
+
readonly weba: readonly ["video/webm"];
|
|
212
|
+
readonly webp: readonly ["image/webp"];
|
|
213
|
+
readonly woff: readonly ["font/woff"];
|
|
214
|
+
readonly woff2: readonly ["font/woff2"];
|
|
215
|
+
readonly xhtml: readonly ["application/xhtml+xml"];
|
|
216
|
+
readonly xls: readonly ["application/vnd.ms-excel"];
|
|
217
|
+
readonly xlsx: readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];
|
|
218
|
+
readonly xml: readonly ["application/xml"];
|
|
219
|
+
readonly xul: readonly ["application/vnd.mozilla.xul+xml"];
|
|
220
|
+
readonly yaml: readonly ["application/yaml"];
|
|
221
|
+
readonly yml: readonly ["application/yaml"];
|
|
222
|
+
readonly zip: readonly ["application/zip", "application/x-zip-compressed"];
|
|
223
|
+
readonly "3gp": readonly ["video/3gpp"];
|
|
224
|
+
readonly "3g2": readonly ["video/3gpp2"];
|
|
225
|
+
readonly "7z": readonly ["application/x-7z-compressed"];
|
|
226
|
+
};
|
|
227
|
+
assetType<const T extends string>(url: T): "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avif" | "avi" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "jar" | "jpeg" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpeg" | "mpkg" | "ndjson" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "png" | "pdf" | "php" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rtf" | "sh" | "sql" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
|
|
228
|
+
getMimes<const E extends FileExtension>(ext: E): readonly ["audio/aac"] | readonly ["application/x-abiword"] | readonly ["image/aces"] | readonly ["image/apng"] | readonly ["application/x-freearc"] | readonly ["image/avci"] | readonly ["image/avif"] | readonly ["video/x-msvideo"] | readonly ["application/vnd.amazon.ebook"] | readonly ["application/octet-stream"] | readonly ["image/bmp"] | readonly ["application/x-bzip"] | readonly ["application/x-bzip2"] | readonly ["application/x-cdf"] | readonly ["application/node", "text/javascript"] | readonly ["application/x-csh"] | readonly ["text/css"] | readonly ["text/csv"] | readonly ["application/msword"] | readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] | readonly ["image/dpx"] | readonly ["image/emf"] | readonly ["application/vnd.ms-fontobject"] | readonly ["application/epub+zip"] | readonly ["image/gif"] | readonly ["model/gltf-binary"] | readonly ["model/gltf+json"] | readonly ["application/x-gzip", "application/gzip"] | readonly ["haptics/hjif"] | readonly ["haptics/hmpg"] | readonly ["text/html"] | readonly ["image/vnd.microsoft.icon"] | readonly ["text/calendar"] | readonly ["haptics/ivs"] | readonly ["application/java-archive"] | readonly ["image/jpeg"] | readonly ["application/json"] | readonly ["application/ld+json"] | readonly ["image/ktx"] | readonly ["image/ktx2"] | readonly ["application/vnd.apple.mpegurl"] | readonly ["audio/mp4"] | readonly ["video/mp4"] | readonly ["text/markdown"] | readonly ["application/x-mdx"] | readonly ["audio/midi"] | readonly ["audio/x-midi"] | readonly ["text/javascript"] | readonly ["audio/mpeg"] | readonly ["video/mpeg"] | readonly ["application/vnd.apple.installer+xml"] | readonly ["application/x-ndjson"] | readonly ["application/octet-stream", "text/plain", "model/obj"] | readonly ["application/vnd.oasis.opendocument.presentation"] | readonly ["application/vnd.oasis.opendocument.spreadsheet"] | readonly ["application/vnd.oasis.opendocument.text"] | readonly ["audio/ogg"] | readonly ["video/ogg"] | readonly ["application/ogg"] | readonly ["font/otf"] | readonly ["image/png"] | readonly ["application/pdf"] | readonly ["application/x-httpd-php"] | readonly ["application/vnd.apple.pkpass"] | readonly ["application/vnd.ms-powerpoint"] | readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"] | readonly ["text/x-python"] | readonly ["application/x-python-code"] | readonly ["application/vnd.rar"] | readonly ["application/rtf"] | readonly ["application/x-sh"] | readonly ["application/sql"] | readonly ["image/svg+xml"] | readonly ["application/x-tar"] | readonly ["image/tiff"] | readonly ["application/toml"] | readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"] | readonly ["application/font-sfnt", "font/ttf"] | readonly ["text/plain"] | readonly ["model/vnd.usdz+zip"] | readonly ["application/vnd.visio"] | readonly ["text/vtt"] | readonly ["application/wasm"] | readonly ["audio/wav"] | readonly ["video/webm"] | readonly ["image/webp"] | readonly ["font/woff"] | readonly ["font/woff2"] | readonly ["application/xhtml+xml"] | readonly ["application/vnd.ms-excel"] | readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] | readonly ["application/xml"] | readonly ["application/vnd.mozilla.xul+xml"] | readonly ["application/yaml"] | readonly ["application/zip", "application/x-zip-compressed"] | readonly ["video/3gpp"] | readonly ["video/3gpp2"] | readonly ["application/x-7z-compressed"];
|
|
229
|
+
getMimeFor<const E extends FileExtension>(ext: E, opts?: {
|
|
230
|
+
type?: MimeTopLevelType;
|
|
231
|
+
}): FileExtensionToMimeType<E>;
|
|
232
|
+
isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "application/octet-stream" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/x-gzip" | "application/gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "text/plain" | "model/obj" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "application/rtf" | "application/x-sh" | "application/sql" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
|
|
233
|
+
getMimeTypeForPath<T extends string>(path: T, opts?: {
|
|
234
|
+
type?: MimeTopLevelType;
|
|
235
|
+
}): "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "application/octet-stream" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/x-gzip" | "application/gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "text/plain" | "model/obj" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "application/rtf" | "application/x-sh" | "application/sql" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type PresentMimeTopLevelTypes, extMimeMap };
|