@d0paminedriven/fs 4.1.0 → 5.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/dist/chunk-7QVYU63E.js +7 -0
- package/dist/chunk-EHOBCDHE.js +161 -0
- package/dist/chunk-HWF53VET.js +322 -0
- package/dist/chunk-QMN5ZCE4.js +131 -0
- package/dist/chunk-XHN56MDK.js +30 -0
- package/dist/fs/index.cjs +195 -487
- package/dist/fs/index.d.cts +8 -382
- package/dist/fs/index.d.ts +8 -382
- package/dist/fs/index.js +4 -2
- package/dist/index.cjs +328 -490
- 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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { UrlService } from '../url/index.js';
|
|
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 };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -120,13 +120,13 @@ type WriteFileAsyncProps<T extends string = string> = {
|
|
|
120
120
|
};
|
|
121
121
|
type RmDirOptions = {
|
|
122
122
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
124
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
125
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
126
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
127
|
+
* `true`.
|
|
128
|
+
* @default 0
|
|
129
|
+
*/
|
|
130
130
|
maxRetries?: number | undefined;
|
|
131
131
|
/**
|
|
132
132
|
* @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
|
|
@@ -147,7 +147,7 @@ type RmDirOptions = {
|
|
|
147
147
|
};
|
|
148
148
|
type RmDirProps = {
|
|
149
149
|
options?: RmDirOptions;
|
|
150
|
-
}[
|
|
150
|
+
}["options"];
|
|
151
151
|
type ReadDirProps<T extends string> = {
|
|
152
152
|
path: T;
|
|
153
153
|
options?: ReadDirOptions;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -120,13 +120,13 @@ type WriteFileAsyncProps<T extends string = string> = {
|
|
|
120
120
|
};
|
|
121
121
|
type RmDirOptions = {
|
|
122
122
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
124
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
125
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
126
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
127
|
+
* `true`.
|
|
128
|
+
* @default 0
|
|
129
|
+
*/
|
|
130
130
|
maxRetries?: number | undefined;
|
|
131
131
|
/**
|
|
132
132
|
* @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
|
|
@@ -147,7 +147,7 @@ type RmDirOptions = {
|
|
|
147
147
|
};
|
|
148
148
|
type RmDirProps = {
|
|
149
149
|
options?: RmDirOptions;
|
|
150
|
-
}[
|
|
150
|
+
}["options"];
|
|
151
151
|
type ReadDirProps<T extends string> = {
|
|
152
152
|
path: T;
|
|
153
153
|
options?: ReadDirOptions;
|
package/dist/types/index.js
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
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/url/index.ts
|
|
22
|
+
var url_exports = {};
|
|
23
|
+
__export(url_exports, {
|
|
24
|
+
UrlService: () => UrlService
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(url_exports);
|
|
27
|
+
var UrlService = class {
|
|
28
|
+
static {
|
|
29
|
+
__name(this, "UrlService");
|
|
30
|
+
}
|
|
31
|
+
URL_REGEX = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
|
32
|
+
parseUrl(url) {
|
|
33
|
+
const parsed = this.URL_REGEX.exec(url);
|
|
34
|
+
if (parsed) {
|
|
35
|
+
return {
|
|
36
|
+
href: parsed[0],
|
|
37
|
+
protocol: parsed[1] ?? "",
|
|
38
|
+
baseUrl: `${parsed[1]}${parsed[3]}`,
|
|
39
|
+
host: parsed[4] ?? "",
|
|
40
|
+
pathname: parsed[5] ?? "",
|
|
41
|
+
search: parsed[6] ?? "",
|
|
42
|
+
hash: parsed[8] ?? ""
|
|
43
|
+
};
|
|
44
|
+
} else return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
UrlService
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
|
|
2
|
+
type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
|
|
3
|
+
type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
|
|
4
|
+
type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXTENSION";
|
|
5
|
+
/**
|
|
6
|
+
* usage
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* type FileExtExample = UrlFileExt<"https://raw.githubusercontent.com/mrdoob/three.js/refs/heads/dev/examples/models/gltf/collision-world.glb"> // "glb"
|
|
10
|
+
* type NoFileExtExample = UrlFileExt<"https://raw.githubusercontent.com/mrdoob/three.js/refs/heads/dev/examples/models/gltf/collision-world"> // "NO_EXTENSION"
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
|
|
15
|
+
declare class UrlService {
|
|
16
|
+
private URL_REGEX;
|
|
17
|
+
parseUrl(url: string): {
|
|
18
|
+
href: string;
|
|
19
|
+
protocol: string;
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
host: string;
|
|
22
|
+
pathname: string;
|
|
23
|
+
search: string;
|
|
24
|
+
hash: string;
|
|
25
|
+
} | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { type HandleQueryParamsOrHash, type InferExtensionIfPresent, type LastSegment, type SplitForwardSlash, type UrlFileExt, UrlService };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
|
|
2
|
+
type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
|
|
3
|
+
type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
|
|
4
|
+
type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXTENSION";
|
|
5
|
+
/**
|
|
6
|
+
* usage
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* type FileExtExample = UrlFileExt<"https://raw.githubusercontent.com/mrdoob/three.js/refs/heads/dev/examples/models/gltf/collision-world.glb"> // "glb"
|
|
10
|
+
* type NoFileExtExample = UrlFileExt<"https://raw.githubusercontent.com/mrdoob/three.js/refs/heads/dev/examples/models/gltf/collision-world"> // "NO_EXTENSION"
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
|
|
15
|
+
declare class UrlService {
|
|
16
|
+
private URL_REGEX;
|
|
17
|
+
parseUrl(url: string): {
|
|
18
|
+
href: string;
|
|
19
|
+
protocol: string;
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
host: string;
|
|
22
|
+
pathname: string;
|
|
23
|
+
search: string;
|
|
24
|
+
hash: string;
|
|
25
|
+
} | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { type HandleQueryParamsOrHash, type InferExtensionIfPresent, type LastSegment, type SplitForwardSlash, type UrlFileExt, UrlService };
|
|
@@ -0,0 +1,152 @@
|
|
|
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/utils/index.ts
|
|
22
|
+
var utils_exports = {};
|
|
23
|
+
__export(utils_exports, {
|
|
24
|
+
UtilsService: () => UtilsService
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var UtilsService = class {
|
|
28
|
+
static {
|
|
29
|
+
__name(this, "UtilsService");
|
|
30
|
+
}
|
|
31
|
+
chunkArray(arr, maxChunkLength) {
|
|
32
|
+
const chunks = Array.of();
|
|
33
|
+
let currentChunkLength = 0;
|
|
34
|
+
let currentChunk = Array.of();
|
|
35
|
+
for (const [index, val] of arr.entries()) {
|
|
36
|
+
if (val.length + currentChunkLength >= maxChunkLength) {
|
|
37
|
+
if (currentChunk.length) {
|
|
38
|
+
chunks.push(currentChunk);
|
|
39
|
+
}
|
|
40
|
+
currentChunkLength = val.length;
|
|
41
|
+
currentChunk = [val];
|
|
42
|
+
} else {
|
|
43
|
+
currentChunk.push(val);
|
|
44
|
+
currentChunkLength += val.length + 1;
|
|
45
|
+
}
|
|
46
|
+
if (arr.length === index + 1) {
|
|
47
|
+
chunks.push(currentChunk);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return chunks.length ? chunks : [arr];
|
|
51
|
+
}
|
|
52
|
+
b64ToBlob(b64Data) {
|
|
53
|
+
{
|
|
54
|
+
const sliceSize = 512;
|
|
55
|
+
const typeMatch = b64Data.match(
|
|
56
|
+
/^data:(?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*;base64,/i
|
|
57
|
+
);
|
|
58
|
+
const type = typeMatch?.[1];
|
|
59
|
+
if (!typeMatch) {
|
|
60
|
+
throw new Error(`${b64Data} is not a valid data Url`);
|
|
61
|
+
}
|
|
62
|
+
const byteCharacters = Buffer.from(b64Data, "base64").toString("utf-8");
|
|
63
|
+
const byteArrays = Array.of();
|
|
64
|
+
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
65
|
+
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
66
|
+
const byteNumbers = Array.of();
|
|
67
|
+
byteNumbers.push(slice.length);
|
|
68
|
+
for (let i = 0; i < slice.length; i++) {
|
|
69
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
70
|
+
}
|
|
71
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
72
|
+
byteArrays.push(byteArray);
|
|
73
|
+
}
|
|
74
|
+
const blob = new Blob(byteArrays, { type });
|
|
75
|
+
return blob;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
arrToArrOfArrs = /* @__PURE__ */ __name(({
|
|
79
|
+
arrToFragment = Array.of(),
|
|
80
|
+
arrOfArrsAggregator = Array.of(),
|
|
81
|
+
interval
|
|
82
|
+
}) => new Promise(
|
|
83
|
+
(resolve, _reject) => resolve(
|
|
84
|
+
((interval2) => {
|
|
85
|
+
for (let i = 0; i <= arrToFragment.length; i++) {
|
|
86
|
+
if ((i % interval2 === 0 || i === 0) && i <= arrToFragment.length) {
|
|
87
|
+
let segment = arrToFragment.slice(i, i + interval2);
|
|
88
|
+
arrOfArrsAggregator.push(segment);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
})(interval)
|
|
92
|
+
)
|
|
93
|
+
).then((_) => arrOfArrsAggregator), "arrToArrOfArrs");
|
|
94
|
+
extractTuple(obj, props) {
|
|
95
|
+
return [props, obj[props]];
|
|
96
|
+
}
|
|
97
|
+
sort(obj, order) {
|
|
98
|
+
return Object.fromEntries(
|
|
99
|
+
Object.entries(obj).sort(
|
|
100
|
+
([a, _aa], [b, _bb]) => order === "DESC" ? b.localeCompare(a) - a.localeCompare(b) : a.localeCompare(b) - b.localeCompare(a)
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
excludeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
105
|
+
const resolve = Object.fromEntries(
|
|
106
|
+
Object.entries(obj).map(([key, val]) => {
|
|
107
|
+
if (props.includes(key)) {
|
|
108
|
+
return ["omit", "omit"];
|
|
109
|
+
} else return [key, val];
|
|
110
|
+
}).filter(([t, _v]) => /omit/.test(t) === false)
|
|
111
|
+
);
|
|
112
|
+
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
113
|
+
}, "excludeTargeted");
|
|
114
|
+
includeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
115
|
+
const resolve = Object.fromEntries(
|
|
116
|
+
props.map((val) => this.extractTuple(obj, val))
|
|
117
|
+
);
|
|
118
|
+
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
119
|
+
}, "includeTargeted");
|
|
120
|
+
countsSorter = /* @__PURE__ */ __name(({
|
|
121
|
+
counter,
|
|
122
|
+
keySort,
|
|
123
|
+
valSort
|
|
124
|
+
}) => Object.fromEntries(
|
|
125
|
+
Object.entries(counter).sort(
|
|
126
|
+
([aStr, _aNum], [bStr, _bNum]) => keySort === "DESC" ? bStr.localeCompare(aStr) - aStr.localeCompare(bStr) : aStr.localeCompare(bStr) - bStr.localeCompare(aStr)
|
|
127
|
+
).sort(
|
|
128
|
+
([_aStr, aNum], [_bStr, bNum]) => valSort === "ASC" ? aNum - bNum : bNum - aNum
|
|
129
|
+
)
|
|
130
|
+
), "countsSorter");
|
|
131
|
+
range(from, to) {
|
|
132
|
+
const values = Array.of();
|
|
133
|
+
for (let i = from; i < to; i++) {
|
|
134
|
+
values.push(i);
|
|
135
|
+
}
|
|
136
|
+
return values;
|
|
137
|
+
}
|
|
138
|
+
isPrimeNumber = /* @__PURE__ */ __name((n) => {
|
|
139
|
+
for (let i = 2; n > i; i++) {
|
|
140
|
+
if (n % i === 0) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return n > 1;
|
|
145
|
+
}, "isPrimeNumber");
|
|
146
|
+
acceptor = /* @__PURE__ */ __name((num) => [...Array(num !== 0 ? num : this.range(num = -101, num = 101)).keys()].reverse().filter(this.isPrimeNumber), "acceptor");
|
|
147
|
+
};
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
150
|
+
UtilsService
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RemoveFields, Unenumerate } from '../types/index.cjs';
|
|
2
|
+
import 'stream';
|
|
3
|
+
import 'buffer';
|
|
4
|
+
|
|
5
|
+
declare class UtilsService {
|
|
6
|
+
chunkArray<T extends number>(arr: string[], maxChunkLength: T): string[][];
|
|
7
|
+
b64ToBlob<const T extends string>(b64Data: T): Blob;
|
|
8
|
+
arrToArrOfArrs: <const T, const N extends number>({ arrToFragment, arrOfArrsAggregator, interval }: {
|
|
9
|
+
arrToFragment: T[];
|
|
10
|
+
arrOfArrsAggregator: T[][];
|
|
11
|
+
interval: N;
|
|
12
|
+
}) => Promise<T[][]>;
|
|
13
|
+
extractTuple<const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T>(obj: T, props: V): readonly [V, T[V]];
|
|
14
|
+
sort<const S extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const K extends "ASC" | "DESC" | undefined>(obj: S, order?: K): S;
|
|
15
|
+
excludeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => RemoveFields<T, Unenumerate<typeof props>>;
|
|
16
|
+
includeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => Pick<T, Unenumerate<typeof props>>;
|
|
17
|
+
countsSorter: <T extends Record<string, number> | Readonly<Record<string, number>>, K extends "ASC" | "DESC" | undefined, V extends "ASC" | "DESC" | undefined>({ counter, keySort, valSort }: {
|
|
18
|
+
counter: T;
|
|
19
|
+
keySort?: K;
|
|
20
|
+
valSort?: V;
|
|
21
|
+
}) => {
|
|
22
|
+
[k: string]: number;
|
|
23
|
+
};
|
|
24
|
+
range(from: number, to: number): number[];
|
|
25
|
+
isPrimeNumber: <const T extends number>(n: T) => boolean;
|
|
26
|
+
acceptor: (num: number) => number[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { UtilsService };
|