@d0paminedriven/fs 6.0.1 → 6.3.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/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-73BXX52B.js";
3
+ } from "./chunk-NGBMZGGU.js";
4
4
  import {
5
5
  MimeService,
6
- extMimeMap
7
- } from "./chunk-EHOBCDHE.js";
6
+ extMimeMap,
7
+ mimeToExt
8
+ } from "./chunk-C6AZRX7V.js";
8
9
  import {
9
10
  unitsObj
10
- } from "./chunk-4X5DVWVM.js";
11
+ } from "./chunk-MXEE2WS7.js";
11
12
  import {
12
13
  UrlService
13
14
  } from "./chunk-XHN56MDK.js";
14
15
  import {
15
16
  UtilsService
16
- } from "./chunk-QMN5ZCE4.js";
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
@@ -22,7 +22,8 @@ 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
 
@@ -59,7 +60,7 @@ var extMimeMap = {
59
60
  avif: ["image/avif"],
60
61
  avi: ["video/x-msvideo"],
61
62
  azw: ["application/vnd.amazon.ebook"],
62
- bin: ["application/octet-stream"],
63
+ bin: ["application/octet-stream", "multipart/voice-message"],
63
64
  bmp: ["image/bmp"],
64
65
  bz: ["application/x-bzip"],
65
66
  bz2: ["application/x-bzip2"],
@@ -79,7 +80,7 @@ var extMimeMap = {
79
80
  gif: ["image/gif"],
80
81
  glb: ["model/gltf-binary"],
81
82
  gltf: ["model/gltf+json"],
82
- gz: ["application/x-gzip", "application/gzip"],
83
+ gz: ["application/gzip", "application/x-gzip"],
83
84
  hjif: ["haptics/hjif"],
84
85
  hmpg: ["haptics/hmpg"],
85
86
  htm: ["text/html"],
@@ -87,6 +88,7 @@ var extMimeMap = {
87
88
  ico: ["image/vnd.microsoft.icon"],
88
89
  ics: ["text/calendar"],
89
90
  ivs: ["haptics/ivs"],
91
+ ivt: ["haptics/ivs"],
90
92
  jar: ["application/java-archive"],
91
93
  jpeg: ["image/jpeg"],
92
94
  jpg: ["image/jpeg"],
@@ -108,7 +110,8 @@ var extMimeMap = {
108
110
  mpeg: ["video/mpeg"],
109
111
  mpkg: ["application/vnd.apple.installer+xml"],
110
112
  ndjson: ["application/x-ndjson"],
111
- obj: ["application/octet-stream", "text/plain", "model/obj"],
113
+ node: ["application/node", "text/javascript"],
114
+ obj: ["model/obj", "application/octet-stream", "text/plain"],
112
115
  odp: ["application/vnd.oasis.opendocument.presentation"],
113
116
  ods: ["application/vnd.oasis.opendocument.spreadsheet"],
114
117
  odt: ["application/vnd.oasis.opendocument.text"],
@@ -129,9 +132,11 @@ var extMimeMap = {
129
132
  py: ["text/x-python"],
130
133
  pyc: ["application/x-python-code"],
131
134
  rar: ["application/vnd.rar"],
135
+ rs: ["text/rust"],
132
136
  rtf: ["application/rtf"],
133
137
  sh: ["application/x-sh"],
134
138
  sql: ["application/sql"],
139
+ sse: ["text/event-stream"],
135
140
  svg: ["image/svg+xml"],
136
141
  tar: ["application/x-tar"],
137
142
  tif: ["image/tiff"],
@@ -161,6 +166,118 @@ var extMimeMap = {
161
166
  "3g2": ["video/3gpp2"],
162
167
  "7z": ["application/x-7z-compressed"]
163
168
  };
169
+ var mimeToExt = {
170
+ "application/epub+zip": ["epub"],
171
+ "application/font-sfnt": ["ttf"],
172
+ "application/gzip": ["gz"],
173
+ "application/java-archive": ["jar"],
174
+ "application/json": ["json"],
175
+ "application/ld+json": ["jsonld"],
176
+ "application/msword": ["doc"],
177
+ "application/node": ["node", "js"],
178
+ "application/octet-stream": ["bin", "obj"],
179
+ "application/ogg": ["ogx"],
180
+ "application/pdf": ["pdf"],
181
+ "application/rtf": ["rtf"],
182
+ "application/sql": ["sql"],
183
+ "application/toml": ["toml"],
184
+ "application/vnd.amazon.ebook": ["azw"],
185
+ "application/vnd.apple.installer+xml": ["mpkg"],
186
+ "application/vnd.apple.mpegurl": ["m3u8"],
187
+ "application/vnd.apple.pkpass": ["pkpass"],
188
+ "application/vnd.mozilla.xul+xml": ["xul"],
189
+ "application/vnd.ms-excel": ["xls"],
190
+ "application/vnd.ms-fontobject": ["eot"],
191
+ "application/vnd.ms-powerpoint": ["ppt"],
192
+ "application/vnd.oasis.opendocument.presentation": ["odp"],
193
+ "application/vnd.oasis.opendocument.spreadsheet": ["ods"],
194
+ "application/vnd.oasis.opendocument.text": ["odt"],
195
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": [
196
+ "pptx"
197
+ ],
198
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"],
199
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
200
+ "docx"
201
+ ],
202
+ "application/vnd.rar": ["rar"],
203
+ "application/vnd.visio": ["vsd"],
204
+ "application/wasm": ["wasm"],
205
+ "application/x-7z-compressed": ["7z"],
206
+ "application/x-abiword": ["abw"],
207
+ "application/x-bzip": ["bz"],
208
+ "application/x-bzip2": ["bz2"],
209
+ "application/x-cdf": ["cda"],
210
+ "application/x-csh": ["csh"],
211
+ "application/x-freearc": ["arc"],
212
+ "application/x-gzip": ["gz"],
213
+ "application/x-httpd-php": ["php"],
214
+ "application/x-mdx": ["mdx"],
215
+ "application/x-ndjson": ["ndjson"],
216
+ "application/x-python-code": ["pyc"],
217
+ "application/x-sh": ["sh"],
218
+ "application/x-tar": ["tar"],
219
+ "application/x-zip-compressed": ["zip"],
220
+ "application/xhtml+xml": ["xhtml"],
221
+ "application/xml": ["xml"],
222
+ "application/yaml": ["yml", "yaml"],
223
+ "application/zip": ["zip"],
224
+ "audio/aac": ["aac"],
225
+ "audio/midi": ["mid"],
226
+ "audio/mp4": ["m4a"],
227
+ "audio/mpeg": ["mp3"],
228
+ "audio/ogg": ["opus", "ogg", "oga"],
229
+ "audio/wav": ["wav"],
230
+ "audio/x-midi": ["midi"],
231
+ "font/otf": ["otf"],
232
+ "font/ttf": ["ttf"],
233
+ "font/woff": ["woff"],
234
+ "font/woff2": ["woff2"],
235
+ "haptics/hjif": ["hjif"],
236
+ "haptics/hmpg": ["hmpg"],
237
+ "haptics/ivs": ["ivs", "ivt"],
238
+ "image/aces": ["aces"],
239
+ "image/apng": ["apng"],
240
+ "image/avci": ["avci"],
241
+ "image/avif": ["avif"],
242
+ "image/bmp": ["bmp"],
243
+ "image/dpx": ["dpx"],
244
+ "image/emf": ["emf"],
245
+ "image/gif": ["gif"],
246
+ "image/jpeg": ["jpg", "jpeg"],
247
+ "image/ktx": ["ktx"],
248
+ "image/ktx2": ["ktx2"],
249
+ "image/png": ["png"],
250
+ "image/svg+xml": ["svg"],
251
+ "image/tiff": ["tiff", "tif"],
252
+ "image/vnd.microsoft.icon": ["ico"],
253
+ "image/webp": ["webp"],
254
+ "model/gltf-binary": ["glb"],
255
+ "model/gltf+json": ["gltf"],
256
+ "model/obj": ["obj"],
257
+ "model/vnd.usdz+zip": ["usdz"],
258
+ "multipart/voice-message": ["bin"],
259
+ "text/calendar": ["ics"],
260
+ "text/css": ["css"],
261
+ "text/csv": ["csv"],
262
+ "text/event-stream": ["sse", "ts", "rs", "py", "txt"],
263
+ "text/html": ["html", "htm"],
264
+ "text/javascript": ["cjs", "js", "mjs"],
265
+ "text/markdown": ["md"],
266
+ "text/plain": ["txt"],
267
+ "text/rust": ["rs"],
268
+ "text/typescript": ["ts"],
269
+ "text/vtt": ["vtt"],
270
+ "text/x-python": ["py"],
271
+ "video/3gpp": ["3gp"],
272
+ "video/3gpp2": ["3g2"],
273
+ "video/mp2t": ["ts"],
274
+ "video/mp4": ["mp4", "m4v"],
275
+ "video/mpeg": ["mpeg"],
276
+ "video/ogg": ["ogv"],
277
+ "video/vnd.dlna.mpeg-tts": ["ts"],
278
+ "video/webm": ["weba"],
279
+ "video/x-msvideo": ["avi"]
280
+ };
164
281
  var MimeService = class extends UrlService {
165
282
  static {
166
283
  __name(this, "MimeService");
@@ -169,6 +286,35 @@ var MimeService = class extends UrlService {
169
286
  super();
170
287
  }
171
288
  mimeTypeObj = extMimeMap;
289
+ toExtObj = mimeToExt;
290
+ compareMimeToExt(p = "mime") {
291
+ let a = {};
292
+ if (p === "mime") {
293
+ for (const [_key, vals] of Object.entries(extMimeMap)) {
294
+ for (const val of vals) {
295
+ a[val] = (a[val] ?? 0) + 1;
296
+ }
297
+ }
298
+ for (const [key, _val] of Object.entries(mimeToExt)) {
299
+ a[key] = (a[key] ?? 0) + 1;
300
+ }
301
+ return Object.fromEntries(
302
+ Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
303
+ );
304
+ } else {
305
+ for (const [_key, vals] of Object.entries(mimeToExt)) {
306
+ for (const val of vals) {
307
+ a[val] = (a[val] ?? 0) + 1;
308
+ }
309
+ }
310
+ for (const [key, _val] of Object.entries(extMimeMap)) {
311
+ a[key] = (a[key] ?? 0) + 1;
312
+ }
313
+ return Object.fromEntries(
314
+ Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
315
+ );
316
+ }
317
+ }
172
318
  assetType(url) {
173
319
  const parsed = this.parseUrl(url);
174
320
  if (!parsed) return void 0;
@@ -199,6 +345,7 @@ var MimeService = class extends UrlService {
199
345
  // Annotate the CommonJS export names for ESM import in node:
200
346
  0 && (module.exports = {
201
347
  MimeService,
202
- extMimeMap
348
+ extMimeMap,
349
+ mimeToExt
203
350
  });
204
351
  //# sourceMappingURL=index.cjs.map