@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
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UrlService
|
|
3
|
+
} from "./chunk-QBG7TFHM.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-7QVYU63E.js";
|
|
7
|
+
|
|
8
|
+
// src/mime/index.ts
|
|
9
|
+
var extMimeMap = {
|
|
10
|
+
aac: ["audio/aac"],
|
|
11
|
+
abw: ["application/x-abiword"],
|
|
12
|
+
aces: ["image/aces"],
|
|
13
|
+
apng: ["image/apng"],
|
|
14
|
+
arc: ["application/x-freearc"],
|
|
15
|
+
avci: ["image/avci"],
|
|
16
|
+
avif: ["image/avif"],
|
|
17
|
+
avi: ["video/x-msvideo"],
|
|
18
|
+
azw: ["application/vnd.amazon.ebook"],
|
|
19
|
+
bin: ["application/octet-stream", "multipart/voice-message"],
|
|
20
|
+
bmp: ["image/bmp"],
|
|
21
|
+
bz: ["application/x-bzip"],
|
|
22
|
+
bz2: ["application/x-bzip2"],
|
|
23
|
+
cda: ["application/x-cdf"],
|
|
24
|
+
cjs: ["application/node", "text/javascript"],
|
|
25
|
+
csh: ["application/x-csh"],
|
|
26
|
+
css: ["text/css"],
|
|
27
|
+
csv: ["text/csv"],
|
|
28
|
+
doc: ["application/msword"],
|
|
29
|
+
docx: [
|
|
30
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
31
|
+
],
|
|
32
|
+
dpx: ["image/dpx"],
|
|
33
|
+
emf: ["image/emf"],
|
|
34
|
+
eot: ["application/vnd.ms-fontobject"],
|
|
35
|
+
epub: ["application/epub+zip"],
|
|
36
|
+
gif: ["image/gif"],
|
|
37
|
+
glb: ["model/gltf-binary"],
|
|
38
|
+
gltf: ["model/gltf+json"],
|
|
39
|
+
gz: ["application/gzip", "application/x-gzip"],
|
|
40
|
+
hjif: ["haptics/hjif"],
|
|
41
|
+
hmpg: ["haptics/hmpg"],
|
|
42
|
+
htm: ["text/html"],
|
|
43
|
+
html: ["text/html"],
|
|
44
|
+
ico: ["image/vnd.microsoft.icon"],
|
|
45
|
+
ics: ["text/calendar"],
|
|
46
|
+
ivs: ["haptics/ivs"],
|
|
47
|
+
ivt: ["haptics/ivs"],
|
|
48
|
+
jar: ["application/java-archive"],
|
|
49
|
+
jpeg: ["image/jpeg"],
|
|
50
|
+
jpg: ["image/jpeg"],
|
|
51
|
+
js: ["application/node", "text/javascript"],
|
|
52
|
+
json: ["application/json"],
|
|
53
|
+
jsonld: ["application/ld+json"],
|
|
54
|
+
ktx: ["image/ktx"],
|
|
55
|
+
ktx2: ["image/ktx2"],
|
|
56
|
+
m3u8: ["application/vnd.apple.mpegurl"],
|
|
57
|
+
m4a: ["audio/mp4"],
|
|
58
|
+
m4v: ["video/mp4"],
|
|
59
|
+
md: ["text/markdown"],
|
|
60
|
+
mdx: ["application/x-mdx"],
|
|
61
|
+
mid: ["audio/midi"],
|
|
62
|
+
midi: ["audio/x-midi"],
|
|
63
|
+
mjs: ["text/javascript"],
|
|
64
|
+
mp3: ["audio/mpeg"],
|
|
65
|
+
mp4: ["video/mp4"],
|
|
66
|
+
mpeg: ["video/mpeg"],
|
|
67
|
+
mpkg: ["application/vnd.apple.installer+xml"],
|
|
68
|
+
ndjson: ["application/x-ndjson"],
|
|
69
|
+
node: ["application/node", "text/javascript"],
|
|
70
|
+
obj: ["model/obj", "application/octet-stream", "text/plain"],
|
|
71
|
+
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
72
|
+
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
73
|
+
odt: ["application/vnd.oasis.opendocument.text"],
|
|
74
|
+
oga: ["audio/ogg"],
|
|
75
|
+
ogg: ["audio/ogg"],
|
|
76
|
+
ogv: ["video/ogg"],
|
|
77
|
+
ogx: ["application/ogg"],
|
|
78
|
+
opus: ["audio/ogg"],
|
|
79
|
+
otf: ["font/otf"],
|
|
80
|
+
png: ["image/png"],
|
|
81
|
+
pdf: ["application/pdf"],
|
|
82
|
+
php: ["application/x-httpd-php"],
|
|
83
|
+
pkpass: ["application/vnd.apple.pkpass"],
|
|
84
|
+
ppt: ["application/vnd.ms-powerpoint"],
|
|
85
|
+
pptx: [
|
|
86
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
87
|
+
],
|
|
88
|
+
py: ["text/x-python"],
|
|
89
|
+
pyc: ["application/x-python-code"],
|
|
90
|
+
rar: ["application/vnd.rar"],
|
|
91
|
+
rs: ["text/rust"],
|
|
92
|
+
rtf: ["application/rtf"],
|
|
93
|
+
sh: ["application/x-sh"],
|
|
94
|
+
sql: ["application/sql"],
|
|
95
|
+
sse: ["text/event-stream"],
|
|
96
|
+
svg: ["image/svg+xml"],
|
|
97
|
+
tar: ["application/x-tar"],
|
|
98
|
+
tif: ["image/tiff"],
|
|
99
|
+
tiff: ["image/tiff"],
|
|
100
|
+
toml: ["application/toml"],
|
|
101
|
+
ts: ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"],
|
|
102
|
+
ttf: ["application/font-sfnt", "font/ttf"],
|
|
103
|
+
txt: ["text/plain"],
|
|
104
|
+
usdz: ["model/vnd.usdz+zip"],
|
|
105
|
+
vsd: ["application/vnd.visio"],
|
|
106
|
+
vtt: ["text/vtt"],
|
|
107
|
+
wasm: ["application/wasm"],
|
|
108
|
+
wav: ["audio/wav"],
|
|
109
|
+
weba: ["video/webm"],
|
|
110
|
+
webp: ["image/webp"],
|
|
111
|
+
woff: ["font/woff"],
|
|
112
|
+
woff2: ["font/woff2"],
|
|
113
|
+
xhtml: ["application/xhtml+xml"],
|
|
114
|
+
xls: ["application/vnd.ms-excel"],
|
|
115
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
116
|
+
xml: ["application/xml"],
|
|
117
|
+
xul: ["application/vnd.mozilla.xul+xml"],
|
|
118
|
+
yaml: ["application/yaml"],
|
|
119
|
+
yml: ["application/yaml"],
|
|
120
|
+
zip: ["application/zip", "application/x-zip-compressed"],
|
|
121
|
+
"3gp": ["video/3gpp"],
|
|
122
|
+
"3g2": ["video/3gpp2"],
|
|
123
|
+
"7z": ["application/x-7z-compressed"]
|
|
124
|
+
};
|
|
125
|
+
var mimeToExt = {
|
|
126
|
+
"application/epub+zip": ["epub"],
|
|
127
|
+
"application/font-sfnt": ["ttf"],
|
|
128
|
+
"application/gzip": ["gz"],
|
|
129
|
+
"application/java-archive": ["jar"],
|
|
130
|
+
"application/json": ["json"],
|
|
131
|
+
"application/ld+json": ["jsonld"],
|
|
132
|
+
"application/msword": ["doc"],
|
|
133
|
+
"application/node": ["node", "js"],
|
|
134
|
+
"application/octet-stream": ["bin", "obj"],
|
|
135
|
+
"application/ogg": ["ogx"],
|
|
136
|
+
"application/pdf": ["pdf"],
|
|
137
|
+
"application/rtf": ["rtf"],
|
|
138
|
+
"application/sql": ["sql"],
|
|
139
|
+
"application/toml": ["toml"],
|
|
140
|
+
"application/vnd.amazon.ebook": ["azw"],
|
|
141
|
+
"application/vnd.apple.installer+xml": ["mpkg"],
|
|
142
|
+
"application/vnd.apple.mpegurl": ["m3u8"],
|
|
143
|
+
"application/vnd.apple.pkpass": ["pkpass"],
|
|
144
|
+
"application/vnd.mozilla.xul+xml": ["xul"],
|
|
145
|
+
"application/vnd.ms-excel": ["xls"],
|
|
146
|
+
"application/vnd.ms-fontobject": ["eot"],
|
|
147
|
+
"application/vnd.ms-powerpoint": ["ppt"],
|
|
148
|
+
"application/vnd.oasis.opendocument.presentation": ["odp"],
|
|
149
|
+
"application/vnd.oasis.opendocument.spreadsheet": ["ods"],
|
|
150
|
+
"application/vnd.oasis.opendocument.text": ["odt"],
|
|
151
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
|
|
152
|
+
"pptx"
|
|
153
|
+
],
|
|
154
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"],
|
|
155
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
|
156
|
+
"docx"
|
|
157
|
+
],
|
|
158
|
+
"application/vnd.rar": ["rar"],
|
|
159
|
+
"application/vnd.visio": ["vsd"],
|
|
160
|
+
"application/wasm": ["wasm"],
|
|
161
|
+
"application/x-7z-compressed": ["7z"],
|
|
162
|
+
"application/x-abiword": ["abw"],
|
|
163
|
+
"application/x-bzip": ["bz"],
|
|
164
|
+
"application/x-bzip2": ["bz2"],
|
|
165
|
+
"application/x-cdf": ["cda"],
|
|
166
|
+
"application/x-csh": ["csh"],
|
|
167
|
+
"application/x-freearc": ["arc"],
|
|
168
|
+
"application/x-gzip": ["gz"],
|
|
169
|
+
"application/x-httpd-php": ["php"],
|
|
170
|
+
"application/x-mdx": ["mdx"],
|
|
171
|
+
"application/x-ndjson": ["ndjson"],
|
|
172
|
+
"application/x-python-code": ["pyc"],
|
|
173
|
+
"application/x-sh": ["sh"],
|
|
174
|
+
"application/x-tar": ["tar"],
|
|
175
|
+
"application/x-zip-compressed": ["zip"],
|
|
176
|
+
"application/xhtml+xml": ["xhtml"],
|
|
177
|
+
"application/xml": ["xml"],
|
|
178
|
+
"application/yaml": ["yml", "yaml"],
|
|
179
|
+
"application/zip": ["zip"],
|
|
180
|
+
"audio/aac": ["aac"],
|
|
181
|
+
"audio/midi": ["mid"],
|
|
182
|
+
"audio/mp4": ["m4a"],
|
|
183
|
+
"audio/mpeg": ["mp3"],
|
|
184
|
+
"audio/ogg": ["opus", "ogg", "oga"],
|
|
185
|
+
"audio/wav": ["wav"],
|
|
186
|
+
"audio/x-midi": ["midi"],
|
|
187
|
+
"font/otf": ["otf"],
|
|
188
|
+
"font/ttf": ["ttf"],
|
|
189
|
+
"font/woff": ["woff"],
|
|
190
|
+
"font/woff2": ["woff2"],
|
|
191
|
+
"haptics/hjif": ["hjif"],
|
|
192
|
+
"haptics/hmpg": ["hmpg"],
|
|
193
|
+
"haptics/ivs": ["ivs", "ivt"],
|
|
194
|
+
"image/aces": ["aces"],
|
|
195
|
+
"image/apng": ["apng"],
|
|
196
|
+
"image/avci": ["avci"],
|
|
197
|
+
"image/avif": ["avif"],
|
|
198
|
+
"image/bmp": ["bmp"],
|
|
199
|
+
"image/dpx": ["dpx"],
|
|
200
|
+
"image/emf": ["emf"],
|
|
201
|
+
"image/gif": ["gif"],
|
|
202
|
+
"image/jpeg": ["jpg", "jpeg"],
|
|
203
|
+
"image/ktx": ["ktx"],
|
|
204
|
+
"image/ktx2": ["ktx2"],
|
|
205
|
+
"image/png": ["png"],
|
|
206
|
+
"image/svg+xml": ["svg"],
|
|
207
|
+
"image/tiff": ["tiff", "tif"],
|
|
208
|
+
"image/vnd.microsoft.icon": ["ico"],
|
|
209
|
+
"image/webp": ["webp"],
|
|
210
|
+
"model/gltf-binary": ["glb"],
|
|
211
|
+
"model/gltf+json": ["gltf"],
|
|
212
|
+
"model/obj": ["obj"],
|
|
213
|
+
"model/vnd.usdz+zip": ["usdz"],
|
|
214
|
+
"multipart/voice-message": ["bin"],
|
|
215
|
+
"text/calendar": ["ics"],
|
|
216
|
+
"text/css": ["css"],
|
|
217
|
+
"text/csv": ["csv"],
|
|
218
|
+
"text/event-stream": ["sse", "ts", "rs", "py", "txt"],
|
|
219
|
+
"text/html": ["html", "htm"],
|
|
220
|
+
"text/javascript": ["cjs", "js", "mjs"],
|
|
221
|
+
"text/markdown": ["md"],
|
|
222
|
+
"text/plain": ["txt"],
|
|
223
|
+
"text/rust": ["rs"],
|
|
224
|
+
"text/typescript": ["ts"],
|
|
225
|
+
"text/vtt": ["vtt"],
|
|
226
|
+
"text/x-python": ["py"],
|
|
227
|
+
"video/3gpp": ["3gp"],
|
|
228
|
+
"video/3gpp2": ["3g2"],
|
|
229
|
+
"video/mp2t": ["ts"],
|
|
230
|
+
"video/mp4": ["mp4", "m4v"],
|
|
231
|
+
"video/mpeg": ["mpeg"],
|
|
232
|
+
"video/ogg": ["ogv"],
|
|
233
|
+
"video/vnd.dlna.mpeg-tts": ["ts"],
|
|
234
|
+
"video/webm": ["weba"],
|
|
235
|
+
"video/x-msvideo": ["avi"]
|
|
236
|
+
};
|
|
237
|
+
var MimeService = class extends UrlService {
|
|
238
|
+
static {
|
|
239
|
+
__name(this, "MimeService");
|
|
240
|
+
}
|
|
241
|
+
constructor() {
|
|
242
|
+
super();
|
|
243
|
+
}
|
|
244
|
+
mimeTypeObj = extMimeMap;
|
|
245
|
+
toExtObj = mimeToExt;
|
|
246
|
+
compareMimeToExt(p = "mime") {
|
|
247
|
+
let a = {};
|
|
248
|
+
if (p === "mime") {
|
|
249
|
+
for (const [_key, vals] of Object.entries(extMimeMap)) {
|
|
250
|
+
for (const val of vals) {
|
|
251
|
+
a[val] = (a[val] ?? 0) + 1;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
for (const [key, _val] of Object.entries(mimeToExt)) {
|
|
255
|
+
a[key] = (a[key] ?? 0) + 1;
|
|
256
|
+
}
|
|
257
|
+
return Object.fromEntries(
|
|
258
|
+
Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
|
|
259
|
+
);
|
|
260
|
+
} else {
|
|
261
|
+
for (const [_key, vals] of Object.entries(mimeToExt)) {
|
|
262
|
+
for (const val of vals) {
|
|
263
|
+
a[val] = (a[val] ?? 0) + 1;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
for (const [key, _val] of Object.entries(extMimeMap)) {
|
|
267
|
+
a[key] = (a[key] ?? 0) + 1;
|
|
268
|
+
}
|
|
269
|
+
return Object.fromEntries(
|
|
270
|
+
Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
assetType(url) {
|
|
275
|
+
const parsed = this.parseUrl(url);
|
|
276
|
+
if (!parsed) return void 0;
|
|
277
|
+
const ext = parsed.pathname.split(/([.])/g)?.reverse()?.[0]?.toLowerCase();
|
|
278
|
+
return ext && ext in this.mimeTypeObj ? ext : void 0;
|
|
279
|
+
}
|
|
280
|
+
getMimes(ext) {
|
|
281
|
+
return this.mimeTypeObj[ext];
|
|
282
|
+
}
|
|
283
|
+
getMimeFor(ext, opts) {
|
|
284
|
+
const mimes = this.getMimes(ext);
|
|
285
|
+
if (mimes.length === 1) return mimes[0];
|
|
286
|
+
if (opts?.type) {
|
|
287
|
+
const found = mimes.find((mime) => mime.startsWith(opts.type + "/"));
|
|
288
|
+
return found ?? mimes[0];
|
|
289
|
+
}
|
|
290
|
+
return mimes[0];
|
|
291
|
+
}
|
|
292
|
+
isMimeFor(ext, mime) {
|
|
293
|
+
return this.getMimes(ext).find((s) => s === mime);
|
|
294
|
+
}
|
|
295
|
+
getMimeTypeForPath(path, opts) {
|
|
296
|
+
const ext = this.assetType(path);
|
|
297
|
+
if (!ext) return "application/octet-stream";
|
|
298
|
+
return this.getMimeFor(ext, opts);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export {
|
|
303
|
+
extMimeMap,
|
|
304
|
+
mimeToExt,
|
|
305
|
+
MimeService
|
|
306
|
+
};
|
|
307
|
+
//# sourceMappingURL=chunk-O4BKLMFV.js.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UtilsService
|
|
3
|
+
} from "./chunk-IUGBPDQJ.js";
|
|
1
4
|
import {
|
|
2
5
|
__name
|
|
3
6
|
} from "./chunk-7QVYU63E.js";
|
|
4
7
|
|
|
5
8
|
// src/url/index.ts
|
|
6
|
-
var UrlService = class {
|
|
9
|
+
var UrlService = class extends UtilsService {
|
|
7
10
|
static {
|
|
8
11
|
__name(this, "UrlService");
|
|
9
12
|
}
|
|
@@ -27,4 +30,4 @@ var UrlService = class {
|
|
|
27
30
|
export {
|
|
28
31
|
UrlService
|
|
29
32
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-QBG7TFHM.js.map
|