@d0paminedriven/fs 6.1.0 → 6.5.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 +389 -64
- package/dist/{chunk-QMN5ZCE4.js → chunk-IUGBPDQJ.js} +21 -16
- package/dist/{chunk-4X5DVWVM.js → chunk-MXEE2WS7.js} +1 -1
- package/dist/chunk-O4BKLMFV.js +307 -0
- package/dist/{chunk-XHN56MDK.js → chunk-QBG7TFHM.js} +5 -2
- package/dist/{chunk-XIAKCF2X.js → chunk-Y3TLKN7F.js} +414 -8
- package/dist/fs/index.cjs +688 -9
- package/dist/fs/index.d.cts +186 -5
- package/dist/fs/index.d.ts +186 -5
- package/dist/fs/index.js +5 -4
- package/dist/index.cjs +676 -118
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -6
- package/dist/mime/index.cjs +281 -6
- package/dist/mime/index.d.cts +244 -11
- package/dist/mime/index.d.ts +244 -11
- package/dist/mime/index.js +7 -4
- package/dist/types/index.d.cts +93 -31
- package/dist/types/index.d.ts +93 -31
- package/dist/types/index.js +1 -1
- package/dist/url/index.cjs +131 -1
- package/dist/url/index.d.cts +6 -1
- package/dist/url/index.d.ts +6 -1
- package/dist/url/index.js +2 -1
- package/dist/utils/index.cjs +20 -15
- package/dist/utils/index.d.cts +2 -6
- package/dist/utils/index.d.ts +2 -6
- package/dist/utils/index.js +1 -1
- package/package.json +13 -13
- package/dist/chunk-EHOBCDHE.js +0 -161
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.cjs';
|
|
2
|
-
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, PresentMimeTopLevelTypes, extMimeMap } from './mime/index.cjs';
|
|
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, SizeOpts, StdioOptions, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.cjs';
|
|
2
|
+
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, MimeType, MimeTypeToFileExtension, PresentMimeTopLevelTypes, extMimeMap, mimeToExt } from './mime/index.cjs';
|
|
3
|
+
export { Abortable, ArrFieldReplacer, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BoxInfo, BufferEncodingUnion, CTR, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, DX, DeepPartial, DeepPartialFields, DeepReplace, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, ImageSize, InferDepth, InjectScriptsProps, IsExact, IsOptional, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OnlyOptional, OnlyRequired, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, RTC, ReadDirOptions, ReadDirOptionsEntity, ReadDirProps, RemoveFields, RequireNested, RequiredToConditional, Rm, RmDirOptions, RmDirProps, Signals, SizeOpts, StdioOptions, TCN, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.cjs';
|
|
4
4
|
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.cjs';
|
|
5
5
|
export { UtilsService } from './utils/index.cjs';
|
|
6
6
|
import 'dotenv-expand';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.js';
|
|
2
|
-
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, PresentMimeTopLevelTypes, extMimeMap } from './mime/index.js';
|
|
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, SizeOpts, StdioOptions, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.js';
|
|
2
|
+
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, MimeType, MimeTypeToFileExtension, PresentMimeTopLevelTypes, extMimeMap, mimeToExt } from './mime/index.js';
|
|
3
|
+
export { Abortable, ArrFieldReplacer, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BoxInfo, BufferEncodingUnion, CTR, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, DX, DeepPartial, DeepPartialFields, DeepReplace, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, ImageSize, InferDepth, InjectScriptsProps, IsExact, IsOptional, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OnlyOptional, OnlyRequired, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, RTC, ReadDirOptions, ReadDirOptionsEntity, ReadDirProps, RemoveFields, RequireNested, RequiredToConditional, Rm, RmDirOptions, RmDirProps, Signals, SizeOpts, StdioOptions, TCN, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.js';
|
|
4
4
|
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.js';
|
|
5
5
|
export { UtilsService } from './utils/index.js';
|
|
6
6
|
import 'dotenv-expand';
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y3TLKN7F.js";
|
|
4
4
|
import {
|
|
5
5
|
MimeService,
|
|
6
|
-
extMimeMap
|
|
7
|
-
|
|
6
|
+
extMimeMap,
|
|
7
|
+
mimeToExt
|
|
8
|
+
} from "./chunk-O4BKLMFV.js";
|
|
8
9
|
import {
|
|
9
10
|
unitsObj
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MXEE2WS7.js";
|
|
11
12
|
import {
|
|
12
13
|
UrlService
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QBG7TFHM.js";
|
|
14
15
|
import {
|
|
15
16
|
UtilsService
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IUGBPDQJ.js";
|
|
17
18
|
import "./chunk-7QVYU63E.js";
|
|
18
19
|
export {
|
|
19
20
|
Fs,
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
UrlService,
|
|
22
23
|
UtilsService,
|
|
23
24
|
extMimeMap,
|
|
25
|
+
mimeToExt,
|
|
24
26
|
unitsObj
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=index.js.map
|
package/dist/mime/index.cjs
CHANGED
|
@@ -22,12 +22,141 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var mime_exports = {};
|
|
23
23
|
__export(mime_exports, {
|
|
24
24
|
MimeService: () => MimeService,
|
|
25
|
-
extMimeMap: () => extMimeMap
|
|
25
|
+
extMimeMap: () => extMimeMap,
|
|
26
|
+
mimeToExt: () => mimeToExt
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(mime_exports);
|
|
28
29
|
|
|
30
|
+
// src/utils/index.ts
|
|
31
|
+
var UtilsService = class {
|
|
32
|
+
static {
|
|
33
|
+
__name(this, "UtilsService");
|
|
34
|
+
}
|
|
35
|
+
chunkArray(arr, maxChunkLength) {
|
|
36
|
+
const chunks = Array.of();
|
|
37
|
+
let currentChunkLength = 0;
|
|
38
|
+
let currentChunk = Array.of();
|
|
39
|
+
for (const [index, val] of arr.entries()) {
|
|
40
|
+
if (val.length + currentChunkLength >= maxChunkLength) {
|
|
41
|
+
if (currentChunk.length) {
|
|
42
|
+
chunks.push(currentChunk);
|
|
43
|
+
}
|
|
44
|
+
currentChunkLength = val.length;
|
|
45
|
+
currentChunk = [val];
|
|
46
|
+
} else {
|
|
47
|
+
currentChunk.push(val);
|
|
48
|
+
currentChunkLength += val.length + 1;
|
|
49
|
+
}
|
|
50
|
+
if (arr.length === index + 1) {
|
|
51
|
+
chunks.push(currentChunk);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return chunks.length ? chunks : [arr];
|
|
55
|
+
}
|
|
56
|
+
b64ToBlob(b64Data) {
|
|
57
|
+
{
|
|
58
|
+
const sliceSize = 512;
|
|
59
|
+
const typeMatch = /^data:((?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*);base64,(.+)$/i.exec(
|
|
60
|
+
b64Data
|
|
61
|
+
);
|
|
62
|
+
if (!typeMatch) {
|
|
63
|
+
throw new Error(`${b64Data} is not a valid data Url`);
|
|
64
|
+
}
|
|
65
|
+
const type = typeMatch[1];
|
|
66
|
+
const base64Data = typeMatch?.[2] ?? "";
|
|
67
|
+
const byteCharacters = Buffer.from(base64Data, "base64").toString(
|
|
68
|
+
"binary"
|
|
69
|
+
);
|
|
70
|
+
const byteArrays = Array.of();
|
|
71
|
+
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
72
|
+
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
73
|
+
const byteNumbers = new Array(slice.length);
|
|
74
|
+
for (let i = 0; i < slice.length; i++) {
|
|
75
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
76
|
+
}
|
|
77
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
78
|
+
byteArrays.push(byteArray);
|
|
79
|
+
}
|
|
80
|
+
const blob = new Blob(byteArrays, { type });
|
|
81
|
+
return blob;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
arrToArrOfArrs = /* @__PURE__ */ __name(({
|
|
85
|
+
arrToFragment = Array.of(),
|
|
86
|
+
arrOfArrsAggregator = Array.of(),
|
|
87
|
+
interval
|
|
88
|
+
}) => new Promise(
|
|
89
|
+
(resolve, _reject) => resolve(
|
|
90
|
+
((interval2) => {
|
|
91
|
+
for (let i = 0; i <= arrToFragment.length; i++) {
|
|
92
|
+
if ((i % interval2 === 0 || i === 0) && i <= arrToFragment.length) {
|
|
93
|
+
let segment = arrToFragment.slice(i, i + interval2);
|
|
94
|
+
arrOfArrsAggregator.push(segment);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})(interval)
|
|
98
|
+
)
|
|
99
|
+
).then((_) => arrOfArrsAggregator), "arrToArrOfArrs");
|
|
100
|
+
extractTuple(obj, props) {
|
|
101
|
+
return [props, obj[props]];
|
|
102
|
+
}
|
|
103
|
+
sort(obj, order) {
|
|
104
|
+
return Object.fromEntries(
|
|
105
|
+
Object.entries(obj).sort(
|
|
106
|
+
([a, _aa], [b, _bb]) => order === "DESC" ? b.localeCompare(a) - a.localeCompare(b) : a.localeCompare(b) - b.localeCompare(a)
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
excludeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
111
|
+
const resolve = Object.fromEntries(
|
|
112
|
+
Object.entries(obj).map(([key, val]) => {
|
|
113
|
+
if (props.includes(key)) {
|
|
114
|
+
return ["omit", "omit"];
|
|
115
|
+
} else return [key, val];
|
|
116
|
+
}).filter(([t, _v]) => /omit/.test(t) === false)
|
|
117
|
+
);
|
|
118
|
+
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
119
|
+
}, "excludeTargeted");
|
|
120
|
+
includeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
121
|
+
const resolve = Object.fromEntries(
|
|
122
|
+
props.map((val) => this.extractTuple(obj, val))
|
|
123
|
+
);
|
|
124
|
+
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
125
|
+
}, "includeTargeted");
|
|
126
|
+
countsSorter = /* @__PURE__ */ __name((counter, keySort = "ASC", valSort = "DESC") => Object.fromEntries(
|
|
127
|
+
Array.from(Object.entries(counter)).sort(
|
|
128
|
+
([aStr, _aNum], [bStr, _bNum]) => keySort === "DESC" ? bStr.localeCompare(aStr) - aStr.localeCompare(bStr) : aStr.localeCompare(bStr) - bStr.localeCompare(aStr)
|
|
129
|
+
).sort(([aStr, aNum], [bStr, bNum]) => {
|
|
130
|
+
if (typeof (aNum && bNum) === "number") {
|
|
131
|
+
return valSort === "ASC" ? aNum - bNum : bNum - aNum;
|
|
132
|
+
} else if (typeof (aNum && bNum) === "string") {
|
|
133
|
+
return valSort === "ASC" ? aStr.localeCompare(bStr) - bStr.localeCompare(aStr) : bStr.localeCompare(aStr) - aStr.localeCompare(bStr);
|
|
134
|
+
} else
|
|
135
|
+
throw new Error(
|
|
136
|
+
"only Record<string, string> and Record<string,number> types supported"
|
|
137
|
+
);
|
|
138
|
+
})
|
|
139
|
+
), "countsSorter");
|
|
140
|
+
range(from, to) {
|
|
141
|
+
const values = Array.of();
|
|
142
|
+
for (let i = from; i < to; i++) {
|
|
143
|
+
values.push(i);
|
|
144
|
+
}
|
|
145
|
+
return values;
|
|
146
|
+
}
|
|
147
|
+
isPrimeNumber = /* @__PURE__ */ __name((n) => {
|
|
148
|
+
for (let i = 2; n > i; i++) {
|
|
149
|
+
if (n % i === 0) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return n > 1;
|
|
154
|
+
}, "isPrimeNumber");
|
|
155
|
+
acceptor = /* @__PURE__ */ __name((num) => [...Array(num !== 0 ? num : this.range(num = -101, num = 101)).keys()].reverse().filter(this.isPrimeNumber), "acceptor");
|
|
156
|
+
};
|
|
157
|
+
|
|
29
158
|
// src/url/index.ts
|
|
30
|
-
var UrlService = class {
|
|
159
|
+
var UrlService = class extends UtilsService {
|
|
31
160
|
static {
|
|
32
161
|
__name(this, "UrlService");
|
|
33
162
|
}
|
|
@@ -59,7 +188,7 @@ var extMimeMap = {
|
|
|
59
188
|
avif: ["image/avif"],
|
|
60
189
|
avi: ["video/x-msvideo"],
|
|
61
190
|
azw: ["application/vnd.amazon.ebook"],
|
|
62
|
-
bin: ["application/octet-stream"],
|
|
191
|
+
bin: ["application/octet-stream", "multipart/voice-message"],
|
|
63
192
|
bmp: ["image/bmp"],
|
|
64
193
|
bz: ["application/x-bzip"],
|
|
65
194
|
bz2: ["application/x-bzip2"],
|
|
@@ -79,7 +208,7 @@ var extMimeMap = {
|
|
|
79
208
|
gif: ["image/gif"],
|
|
80
209
|
glb: ["model/gltf-binary"],
|
|
81
210
|
gltf: ["model/gltf+json"],
|
|
82
|
-
gz: ["application/
|
|
211
|
+
gz: ["application/gzip", "application/x-gzip"],
|
|
83
212
|
hjif: ["haptics/hjif"],
|
|
84
213
|
hmpg: ["haptics/hmpg"],
|
|
85
214
|
htm: ["text/html"],
|
|
@@ -87,6 +216,7 @@ var extMimeMap = {
|
|
|
87
216
|
ico: ["image/vnd.microsoft.icon"],
|
|
88
217
|
ics: ["text/calendar"],
|
|
89
218
|
ivs: ["haptics/ivs"],
|
|
219
|
+
ivt: ["haptics/ivs"],
|
|
90
220
|
jar: ["application/java-archive"],
|
|
91
221
|
jpeg: ["image/jpeg"],
|
|
92
222
|
jpg: ["image/jpeg"],
|
|
@@ -108,7 +238,8 @@ var extMimeMap = {
|
|
|
108
238
|
mpeg: ["video/mpeg"],
|
|
109
239
|
mpkg: ["application/vnd.apple.installer+xml"],
|
|
110
240
|
ndjson: ["application/x-ndjson"],
|
|
111
|
-
|
|
241
|
+
node: ["application/node", "text/javascript"],
|
|
242
|
+
obj: ["model/obj", "application/octet-stream", "text/plain"],
|
|
112
243
|
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
113
244
|
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
114
245
|
odt: ["application/vnd.oasis.opendocument.text"],
|
|
@@ -129,9 +260,11 @@ var extMimeMap = {
|
|
|
129
260
|
py: ["text/x-python"],
|
|
130
261
|
pyc: ["application/x-python-code"],
|
|
131
262
|
rar: ["application/vnd.rar"],
|
|
263
|
+
rs: ["text/rust"],
|
|
132
264
|
rtf: ["application/rtf"],
|
|
133
265
|
sh: ["application/x-sh"],
|
|
134
266
|
sql: ["application/sql"],
|
|
267
|
+
sse: ["text/event-stream"],
|
|
135
268
|
svg: ["image/svg+xml"],
|
|
136
269
|
tar: ["application/x-tar"],
|
|
137
270
|
tif: ["image/tiff"],
|
|
@@ -161,6 +294,118 @@ var extMimeMap = {
|
|
|
161
294
|
"3g2": ["video/3gpp2"],
|
|
162
295
|
"7z": ["application/x-7z-compressed"]
|
|
163
296
|
};
|
|
297
|
+
var mimeToExt = {
|
|
298
|
+
"application/epub+zip": ["epub"],
|
|
299
|
+
"application/font-sfnt": ["ttf"],
|
|
300
|
+
"application/gzip": ["gz"],
|
|
301
|
+
"application/java-archive": ["jar"],
|
|
302
|
+
"application/json": ["json"],
|
|
303
|
+
"application/ld+json": ["jsonld"],
|
|
304
|
+
"application/msword": ["doc"],
|
|
305
|
+
"application/node": ["node", "js"],
|
|
306
|
+
"application/octet-stream": ["bin", "obj"],
|
|
307
|
+
"application/ogg": ["ogx"],
|
|
308
|
+
"application/pdf": ["pdf"],
|
|
309
|
+
"application/rtf": ["rtf"],
|
|
310
|
+
"application/sql": ["sql"],
|
|
311
|
+
"application/toml": ["toml"],
|
|
312
|
+
"application/vnd.amazon.ebook": ["azw"],
|
|
313
|
+
"application/vnd.apple.installer+xml": ["mpkg"],
|
|
314
|
+
"application/vnd.apple.mpegurl": ["m3u8"],
|
|
315
|
+
"application/vnd.apple.pkpass": ["pkpass"],
|
|
316
|
+
"application/vnd.mozilla.xul+xml": ["xul"],
|
|
317
|
+
"application/vnd.ms-excel": ["xls"],
|
|
318
|
+
"application/vnd.ms-fontobject": ["eot"],
|
|
319
|
+
"application/vnd.ms-powerpoint": ["ppt"],
|
|
320
|
+
"application/vnd.oasis.opendocument.presentation": ["odp"],
|
|
321
|
+
"application/vnd.oasis.opendocument.spreadsheet": ["ods"],
|
|
322
|
+
"application/vnd.oasis.opendocument.text": ["odt"],
|
|
323
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
|
|
324
|
+
"pptx"
|
|
325
|
+
],
|
|
326
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"],
|
|
327
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
|
328
|
+
"docx"
|
|
329
|
+
],
|
|
330
|
+
"application/vnd.rar": ["rar"],
|
|
331
|
+
"application/vnd.visio": ["vsd"],
|
|
332
|
+
"application/wasm": ["wasm"],
|
|
333
|
+
"application/x-7z-compressed": ["7z"],
|
|
334
|
+
"application/x-abiword": ["abw"],
|
|
335
|
+
"application/x-bzip": ["bz"],
|
|
336
|
+
"application/x-bzip2": ["bz2"],
|
|
337
|
+
"application/x-cdf": ["cda"],
|
|
338
|
+
"application/x-csh": ["csh"],
|
|
339
|
+
"application/x-freearc": ["arc"],
|
|
340
|
+
"application/x-gzip": ["gz"],
|
|
341
|
+
"application/x-httpd-php": ["php"],
|
|
342
|
+
"application/x-mdx": ["mdx"],
|
|
343
|
+
"application/x-ndjson": ["ndjson"],
|
|
344
|
+
"application/x-python-code": ["pyc"],
|
|
345
|
+
"application/x-sh": ["sh"],
|
|
346
|
+
"application/x-tar": ["tar"],
|
|
347
|
+
"application/x-zip-compressed": ["zip"],
|
|
348
|
+
"application/xhtml+xml": ["xhtml"],
|
|
349
|
+
"application/xml": ["xml"],
|
|
350
|
+
"application/yaml": ["yml", "yaml"],
|
|
351
|
+
"application/zip": ["zip"],
|
|
352
|
+
"audio/aac": ["aac"],
|
|
353
|
+
"audio/midi": ["mid"],
|
|
354
|
+
"audio/mp4": ["m4a"],
|
|
355
|
+
"audio/mpeg": ["mp3"],
|
|
356
|
+
"audio/ogg": ["opus", "ogg", "oga"],
|
|
357
|
+
"audio/wav": ["wav"],
|
|
358
|
+
"audio/x-midi": ["midi"],
|
|
359
|
+
"font/otf": ["otf"],
|
|
360
|
+
"font/ttf": ["ttf"],
|
|
361
|
+
"font/woff": ["woff"],
|
|
362
|
+
"font/woff2": ["woff2"],
|
|
363
|
+
"haptics/hjif": ["hjif"],
|
|
364
|
+
"haptics/hmpg": ["hmpg"],
|
|
365
|
+
"haptics/ivs": ["ivs", "ivt"],
|
|
366
|
+
"image/aces": ["aces"],
|
|
367
|
+
"image/apng": ["apng"],
|
|
368
|
+
"image/avci": ["avci"],
|
|
369
|
+
"image/avif": ["avif"],
|
|
370
|
+
"image/bmp": ["bmp"],
|
|
371
|
+
"image/dpx": ["dpx"],
|
|
372
|
+
"image/emf": ["emf"],
|
|
373
|
+
"image/gif": ["gif"],
|
|
374
|
+
"image/jpeg": ["jpg", "jpeg"],
|
|
375
|
+
"image/ktx": ["ktx"],
|
|
376
|
+
"image/ktx2": ["ktx2"],
|
|
377
|
+
"image/png": ["png"],
|
|
378
|
+
"image/svg+xml": ["svg"],
|
|
379
|
+
"image/tiff": ["tiff", "tif"],
|
|
380
|
+
"image/vnd.microsoft.icon": ["ico"],
|
|
381
|
+
"image/webp": ["webp"],
|
|
382
|
+
"model/gltf-binary": ["glb"],
|
|
383
|
+
"model/gltf+json": ["gltf"],
|
|
384
|
+
"model/obj": ["obj"],
|
|
385
|
+
"model/vnd.usdz+zip": ["usdz"],
|
|
386
|
+
"multipart/voice-message": ["bin"],
|
|
387
|
+
"text/calendar": ["ics"],
|
|
388
|
+
"text/css": ["css"],
|
|
389
|
+
"text/csv": ["csv"],
|
|
390
|
+
"text/event-stream": ["sse", "ts", "rs", "py", "txt"],
|
|
391
|
+
"text/html": ["html", "htm"],
|
|
392
|
+
"text/javascript": ["cjs", "js", "mjs"],
|
|
393
|
+
"text/markdown": ["md"],
|
|
394
|
+
"text/plain": ["txt"],
|
|
395
|
+
"text/rust": ["rs"],
|
|
396
|
+
"text/typescript": ["ts"],
|
|
397
|
+
"text/vtt": ["vtt"],
|
|
398
|
+
"text/x-python": ["py"],
|
|
399
|
+
"video/3gpp": ["3gp"],
|
|
400
|
+
"video/3gpp2": ["3g2"],
|
|
401
|
+
"video/mp2t": ["ts"],
|
|
402
|
+
"video/mp4": ["mp4", "m4v"],
|
|
403
|
+
"video/mpeg": ["mpeg"],
|
|
404
|
+
"video/ogg": ["ogv"],
|
|
405
|
+
"video/vnd.dlna.mpeg-tts": ["ts"],
|
|
406
|
+
"video/webm": ["weba"],
|
|
407
|
+
"video/x-msvideo": ["avi"]
|
|
408
|
+
};
|
|
164
409
|
var MimeService = class extends UrlService {
|
|
165
410
|
static {
|
|
166
411
|
__name(this, "MimeService");
|
|
@@ -169,6 +414,35 @@ var MimeService = class extends UrlService {
|
|
|
169
414
|
super();
|
|
170
415
|
}
|
|
171
416
|
mimeTypeObj = extMimeMap;
|
|
417
|
+
toExtObj = mimeToExt;
|
|
418
|
+
compareMimeToExt(p = "mime") {
|
|
419
|
+
let a = {};
|
|
420
|
+
if (p === "mime") {
|
|
421
|
+
for (const [_key, vals] of Object.entries(extMimeMap)) {
|
|
422
|
+
for (const val of vals) {
|
|
423
|
+
a[val] = (a[val] ?? 0) + 1;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
for (const [key, _val] of Object.entries(mimeToExt)) {
|
|
427
|
+
a[key] = (a[key] ?? 0) + 1;
|
|
428
|
+
}
|
|
429
|
+
return Object.fromEntries(
|
|
430
|
+
Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
|
|
431
|
+
);
|
|
432
|
+
} else {
|
|
433
|
+
for (const [_key, vals] of Object.entries(mimeToExt)) {
|
|
434
|
+
for (const val of vals) {
|
|
435
|
+
a[val] = (a[val] ?? 0) + 1;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
for (const [key, _val] of Object.entries(extMimeMap)) {
|
|
439
|
+
a[key] = (a[key] ?? 0) + 1;
|
|
440
|
+
}
|
|
441
|
+
return Object.fromEntries(
|
|
442
|
+
Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
172
446
|
assetType(url) {
|
|
173
447
|
const parsed = this.parseUrl(url);
|
|
174
448
|
if (!parsed) return void 0;
|
|
@@ -199,6 +473,7 @@ var MimeService = class extends UrlService {
|
|
|
199
473
|
// Annotate the CommonJS export names for ESM import in node:
|
|
200
474
|
0 && (module.exports = {
|
|
201
475
|
MimeService,
|
|
202
|
-
extMimeMap
|
|
476
|
+
extMimeMap,
|
|
477
|
+
mimeToExt
|
|
203
478
|
});
|
|
204
479
|
//# sourceMappingURL=index.cjs.map
|