@d0paminedriven/fs 7.1.0 → 7.2.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UtilsService
3
- } from "./chunk-IUGBPDQJ.js";
3
+ } from "./chunk-O2P3L3CJ.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -30,4 +30,4 @@ var UrlService = class extends UtilsService {
30
30
  export {
31
31
  UrlService
32
32
  };
33
- //# sourceMappingURL=chunk-QBG7TFHM.js.map
33
+ //# sourceMappingURL=chunk-6FJJLFJL.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UrlService
3
- } from "./chunk-QBG7TFHM.js";
3
+ } from "./chunk-6FJJLFJL.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -334,4 +334,4 @@ export {
334
334
  mimeToExt,
335
335
  MimeService
336
336
  };
337
- //# sourceMappingURL=chunk-3WB2TSBO.js.map
337
+ //# sourceMappingURL=chunk-GH6MFTV5.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MimeService
3
- } from "./chunk-3WB2TSBO.js";
3
+ } from "./chunk-GH6MFTV5.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -574,4 +574,4 @@ var ImageService = class extends MimeService {
574
574
  export {
575
575
  ImageService
576
576
  };
577
- //# sourceMappingURL=chunk-LFHV4PPA.js.map
577
+ //# sourceMappingURL=chunk-KUGIFRTF.js.map
@@ -11,4 +11,4 @@ var unitsObj = {
11
11
  export {
12
12
  unitsObj
13
13
  };
14
- //# sourceMappingURL=chunk-RJ2YQE3C.js.map
14
+ //# sourceMappingURL=chunk-MRKO3PAA.js.map
@@ -133,4 +133,4 @@ var UtilsService = class {
133
133
  export {
134
134
  UtilsService
135
135
  };
136
- //# sourceMappingURL=chunk-IUGBPDQJ.js.map
136
+ //# sourceMappingURL=chunk-O2P3L3CJ.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ImageService
3
- } from "./chunk-LFHV4PPA.js";
3
+ } from "./chunk-KUGIFRTF.js";
4
4
  import {
5
5
  unitsObj
6
- } from "./chunk-RJ2YQE3C.js";
6
+ } from "./chunk-MRKO3PAA.js";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-7QVYU63E.js";
@@ -13,7 +13,9 @@ import { execSync } from "child_process";
13
13
  import fsSync from "fs";
14
14
  import fsAsync from "fs/promises";
15
15
  import { tmpdir } from "os";
16
+ import { Readable } from "stream";
16
17
  import { join, relative, resolve } from "path";
18
+ import { ReadableStream as WebReadableStream } from "stream/web";
17
19
  import * as dotenv from "dotenv";
18
20
  import expand from "dotenv-expand";
19
21
  import sharp from "sharp";
@@ -35,6 +37,114 @@ var Fs = class extends ImageService {
35
37
  const buffer = await this.readTmpAsync(target);
36
38
  return this.getImageSpecsWorkup(buffer);
37
39
  }
40
+ /**
41
+ * Async version of withWs with atomic write support and progress tracking
42
+ * @param path Target file path
43
+ * @param data Streamable data to write
44
+ * @param options Optional atomic write and abort signal
45
+ * @returns Promise with path and bytes written
46
+ * @example
47
+ * ```ts
48
+ * const fs = new Fs(process.cwd());
49
+ * // Simple async write
50
+ * const result = await fs.asyncWithWs("output.txt", "Hello World");
51
+ * console.log(`Wrote ${result.bytes} bytes to ${result.path}`);
52
+ *
53
+ * // Atomic write with temp file
54
+ * const { path, bytes } = await fs.asyncWithWs(
55
+ * "critical-data.json",
56
+ * JSON.stringify(data),
57
+ * { atomic: true }
58
+ * );
59
+ * ```
60
+ */
61
+ async asyncWithWs(path, data, options) {
62
+ const { atomic = false, signal: _signal = AbortSignal } = options ?? {};
63
+ let bytes = 0;
64
+ if (!atomic) {
65
+ try {
66
+ if (/\//g.test(path)) {
67
+ return this.generateDirIfDNETmp(this.pathHandler(path), {
68
+ recursive: true
69
+ });
70
+ } else return path;
71
+ } catch (error) {
72
+ console.error(
73
+ `[asyncWithWs non-atomic error]: `.concat(
74
+ error instanceof Error ? error.message : typeof error === "string" ? error : JSON.stringify(error, null, 2)
75
+ )
76
+ );
77
+ } finally {
78
+ const readable = this.toReadable(data);
79
+ const chunks = [];
80
+ for await (const chunk of readable) {
81
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
82
+ }
83
+ const buffer = Buffer.concat(chunks);
84
+ try {
85
+ this.withWs(path, buffer);
86
+ } catch (err) {
87
+ console.error(err);
88
+ } finally {
89
+ return { path, bytes: buffer.length };
90
+ }
91
+ }
92
+ }
93
+ let tmpName;
94
+ try {
95
+ if (/\//g.test(path)) {
96
+ this.generateDirIfDNETmp(this.pathHandler(path), {
97
+ recursive: true
98
+ });
99
+ }
100
+ tmpName = this.uniqueTmpName("atomic", "tmp");
101
+ } catch (error) {
102
+ console.error(
103
+ `[asyncWithWs atomic setup error]: `.concat(
104
+ error instanceof Error ? error.message : typeof error === "string" ? error : JSON.stringify(error, null, 2)
105
+ )
106
+ );
107
+ if (tmpName) {
108
+ try {
109
+ this.rmTmpFile(tmpName);
110
+ } catch (err) {
111
+ console.error(err);
112
+ }
113
+ }
114
+ } finally {
115
+ if (tmpName) {
116
+ let newPath = null;
117
+ let newBytes = 0;
118
+ const readable = this.toReadable(data);
119
+ const chunks = [];
120
+ for await (const chunk of readable) {
121
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
122
+ }
123
+ const buffer = Buffer.concat(chunks);
124
+ bytes = buffer.length;
125
+ try {
126
+ await this.writeTmpAsync(tmpName, buffer.toString());
127
+ const tmpPath = resolve(this.tmpDir, tmpName);
128
+ const finalPath = resolve(this.cwd, path);
129
+ await fsAsync.rename(tmpPath, finalPath);
130
+ newPath = path;
131
+ newBytes = bytes;
132
+ } catch (err) {
133
+ console.error(`[asyncWithWs atomic rename error]:`, err);
134
+ if (this.existsTmp(tmpName)) {
135
+ try {
136
+ this.rmTmpFile(tmpName);
137
+ } catch (err2) {
138
+ console.error(err2);
139
+ }
140
+ }
141
+ throw err;
142
+ }
143
+ return { path, bytes, newPath, newBytes };
144
+ }
145
+ }
146
+ return { path, bytes: 0 };
147
+ }
38
148
  get myEnv() {
39
149
  return dotenv.config({ processEnv: {} });
40
150
  }
@@ -47,6 +157,26 @@ var Fs = class extends ImageService {
47
157
  parseDotEnv() {
48
158
  return expand.expand(this.myEnv);
49
159
  }
160
+ isUint8Array(v) {
161
+ return v instanceof Uint8Array;
162
+ }
163
+ isBuffer(v) {
164
+ return Buffer.isBuffer(v);
165
+ }
166
+ isWebReadableStream(v) {
167
+ return v instanceof WebReadableStream;
168
+ }
169
+ isAsyncIterable(v) {
170
+ return typeof v === "object" && v !== null && Symbol.asyncIterator in v;
171
+ }
172
+ toReadable(data) {
173
+ if (typeof data === "string") return Readable.from([Buffer.from(data)]);
174
+ if (this.isBuffer(data) || this.isUint8Array(data))
175
+ return Readable.from([data]);
176
+ if (this.isWebReadableStream(data)) return Readable.fromWeb(data);
177
+ if (this.isAsyncIterable(data)) return Readable.from(data);
178
+ throw new TypeError("Unsupported data type for toReadable()");
179
+ }
50
180
  /**
51
181
  *
52
182
  * @param target path to the file or directory to check for existence
@@ -281,7 +411,7 @@ var Fs = class extends ImageService {
281
411
  return await fsAsync.writeFile(
282
412
  relative(this.cwd ?? process.cwd(), path),
283
413
  Buffer.from(Buffer.from(data).toJSON().data),
284
- options
414
+ typeof options === "object" ? { ...options } : options
285
415
  );
286
416
  }
287
417
  }, "writeFileAsync");
@@ -507,6 +637,18 @@ var Fs = class extends ImageService {
507
637
  return await sharp(target).toFormat(format, { quality }).toBuffer();
508
638
  }
509
639
  }
640
+ existsTmp(path) {
641
+ return this.exists(resolve(this.tmpDir, path));
642
+ }
643
+ mkdirTmp(path, options = { mode: 511, recursive: true }) {
644
+ return this.mkdirSync(resolve(this.tmpDir, path), options);
645
+ }
646
+ generateDirIfDNETmp(path, options) {
647
+ if (this.existsTmp(path)) return;
648
+ else {
649
+ return this.mkdirTmp(path, options);
650
+ }
651
+ }
510
652
  /**
511
653
  * Write data to a file in the system's tmp directory
512
654
  * @param filename The filename (can include subdirectories like "img-probe/file.txt")
@@ -525,9 +667,17 @@ var Fs = class extends ImageService {
525
667
  const fullPath = resolve(this.tmpDir, filename);
526
668
  Promise.resolve(this.withWs(fullPath, data, options));
527
669
  }
670
+ async writeTmpAsync(filename, data, options) {
671
+ const fullPath = resolve(this.tmpDir, filename);
672
+ return await this.writeFileAsync(
673
+ fullPath,
674
+ data,
675
+ typeof options === "object" ? { ...options, mode: 511 } : options
676
+ );
677
+ }
528
678
  async readTmpAsync(filename) {
529
679
  const fullPath = resolve(this.tmpDir, filename);
530
- if (!this.exists(fullPath)) {
680
+ if (!this.existsTmp(filename)) {
531
681
  throw new Error(`Tmp file not found: ${filename}`);
532
682
  }
533
683
  return await this.fileToBufferAsync(fullPath);
@@ -742,4 +892,4 @@ var Fs = class extends ImageService {
742
892
  export {
743
893
  Fs
744
894
  };
745
- //# sourceMappingURL=chunk-3REIEDSC.js.map
895
+ //# sourceMappingURL=chunk-SYISQ57E.js.map
@@ -1,6 +1,9 @@
1
+ import { Readable } from 'node:stream';
2
+ import { ReadableStream } from 'stream/web';
1
3
  import expand from 'dotenv-expand';
2
4
  import sharp from 'sharp';
3
5
  import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, Unit, SizeOpts, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.js';
6
+ import { Streamable, AsyncIter } from '../types/stream.js';
4
7
  import { ImageService } from '../image/index.js';
5
8
  import '../mime/index.js';
6
9
  import '../url/index.js';
@@ -157,10 +160,50 @@ declare class Fs extends ImageService {
157
160
  iccProfile: string | null;
158
161
  exifDateTimeOriginal: string | null;
159
162
  }>;
163
+ /**
164
+ * Async version of withWs with atomic write support and progress tracking
165
+ * @param path Target file path
166
+ * @param data Streamable data to write
167
+ * @param options Optional atomic write and abort signal
168
+ * @returns Promise with path and bytes written
169
+ * @example
170
+ * ```ts
171
+ * const fs = new Fs(process.cwd());
172
+ * // Simple async write
173
+ * const result = await fs.asyncWithWs("output.txt", "Hello World");
174
+ * console.log(`Wrote ${result.bytes} bytes to ${result.path}`);
175
+ *
176
+ * // Atomic write with temp file
177
+ * const { path, bytes } = await fs.asyncWithWs(
178
+ * "critical-data.json",
179
+ * JSON.stringify(data),
180
+ * { atomic: true }
181
+ * );
182
+ * ```
183
+ */
184
+ asyncWithWs(path: string, data: Streamable, options?: {
185
+ atomic?: boolean;
186
+ signal?: AbortSignal;
187
+ }): Promise<string | {
188
+ path: string;
189
+ bytes: number;
190
+ newPath?: undefined;
191
+ newBytes?: undefined;
192
+ } | {
193
+ path: string;
194
+ bytes: number;
195
+ newPath: string;
196
+ newBytes: number;
197
+ } | undefined>;
160
198
  private get myEnv();
161
199
  get tmpDir(): string;
162
200
  get tmpDirRelative(): string;
163
201
  parseDotEnv(): expand.DotenvExpandOutput;
202
+ isUint8Array(v: unknown): v is Uint8Array<ArrayBufferLike>;
203
+ isBuffer(v: unknown): v is Buffer<ArrayBufferLike>;
204
+ isWebReadableStream(v: unknown): v is ReadableStream<any>;
205
+ isAsyncIterable(v: unknown): v is AsyncIter;
206
+ toReadable(data: Streamable): Readable;
164
207
  /**
165
208
  *
166
209
  * @param target path to the file or directory to check for existence
@@ -260,12 +303,12 @@ declare class Fs extends ImageService {
260
303
  fileToBufferAsync: <const T extends string>(path: T) => Promise<Buffer<ArrayBufferLike>>;
261
304
  dirContainsDir<const From extends string, const To extends string>(readDir: From, targetDir: To, options?: ReadDirOptions): boolean;
262
305
  assetToBuffer<const T extends string>(path: T): Promise<{
263
- readonly b64encodedData: `data:audio/aac;base64, ${string}` | `data:application/x-abiword;base64, ${string}` | `data:image/aces;base64, ${string}` | `data:image/apng;base64, ${string}` | `data:application/x-freearc;base64, ${string}` | `data:image/avci;base64, ${string}` | `data:image/avif;base64, ${string}` | `data:video/x-msvideo;base64, ${string}` | `data:application/vnd.amazon.ebook;base64, ${string}` | `data:application/octet-stream;base64, ${string}` | `data:multipart/voice-message;base64, ${string}` | `data:image/bmp;base64, ${string}` | `data:application/x-bzip;base64, ${string}` | `data:application/x-bzip2;base64, ${string}` | `data:application/x-cdf;base64, ${string}` | `data:application/node;base64, ${string}` | `data:text/javascript;base64, ${string}` | `data:application/x-csh;base64, ${string}` | `data:text/css;base64, ${string}` | `data:text/csv;base64, ${string}` | `data:image/x-icon;base64, ${string}` | `data:application/msword;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64, ${string}` | `data:image/dpx;base64, ${string}` | `data:image/emf;base64, ${string}` | `data:application/vnd.ms-fontobject;base64, ${string}` | `data:application/epub+zip;base64, ${string}` | `data:image/gif;base64, ${string}` | `data:model/gltf-binary;base64, ${string}` | `data:model/gltf+json;base64, ${string}` | `data:application/gzip;base64, ${string}` | `data:application/x-gzip;base64, ${string}` | `data:haptics/hjif;base64, ${string}` | `data:haptics/hmpg;base64, ${string}` | `data:text/html;base64, ${string}` | `data:image/vnd.microsoft.icon;base64, ${string}` | `data:text/calendar;base64, ${string}` | `data:haptics/ivs;base64, ${string}` | `data:application/java-archive;base64, ${string}` | `data:image/jpeg;base64, ${string}` | `data:application/json;base64, ${string}` | `data:application/ld+json;base64, ${string}` | `data:image/ktx;base64, ${string}` | `data:image/ktx2;base64, ${string}` | `data:application/vnd.apple.mpegurl;base64, ${string}` | `data:audio/mp4;base64, ${string}` | `data:video/mp4;base64, ${string}` | `data:text/markdown;base64, ${string}` | `data:application/x-mdx;base64, ${string}` | `data:audio/midi;base64, ${string}` | `data:audio/x-midi;base64, ${string}` | `data:audio/mpeg;base64, ${string}` | `data:application/dash+xml;base64, ${string}` | `data:video/mpeg;base64, ${string}` | `data:application/vnd.apple.installer+xml;base64, ${string}` | `data:application/xml;base64, ${string}` | `data:application/x-ndjson;base64, ${string}` | `data:model/obj;base64, ${string}` | `data:text/plain;base64, ${string}` | `data:application/vnd.oasis.opendocument.presentation;base64, ${string}` | `data:application/vnd.oasis.opendocument.spreadsheet;base64, ${string}` | `data:application/vnd.oasis.opendocument.text;base64, ${string}` | `data:audio/ogg;base64, ${string}` | `data:video/ogg;base64, ${string}` | `data:application/ogg;base64, ${string}` | `data:font/otf;base64, ${string}` | `data:image/png;base64, ${string}` | `data:application/pdf;base64, ${string}` | `data:application/x-httpd-php;base64, ${string}` | `data:application/vnd.apple.pkpass;base64, ${string}` | `data:application/vnd.ms-powerpoint;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.presentationml.presentation;base64, ${string}` | `data:text/x-python;base64, ${string}` | `data:application/x-python-code;base64, ${string}` | `data:application/vnd.rar;base64, ${string}` | `data:text/rust;base64, ${string}` | `data:application/rtf;base64, ${string}` | `data:application/x-sh;base64, ${string}` | `data:application/sql;base64, ${string}` | `data:text/event-stream;base64, ${string}` | `data:image/svg+xml;base64, ${string}` | `data:application/x-tar;base64, ${string}` | `data:image/tiff;base64, ${string}` | `data:application/toml;base64, ${string}` | `data:text/typescript;base64, ${string}` | `data:video/mp2t;base64, ${string}` | `data:video/vnd.dlna.mpeg-tts;base64, ${string}` | `data:application/font-sfnt;base64, ${string}` | `data:font/ttf;base64, ${string}` | `data:model/vnd.usdz+zip;base64, ${string}` | `data:application/vnd.visio;base64, ${string}` | `data:text/vtt;base64, ${string}` | `data:application/wasm;base64, ${string}` | `data:audio/wav;base64, ${string}` | `data:audio/webm;base64, ${string}` | `data:video/webm;base64, ${string}` | `data:application/manifest+json;base64, ${string}` | `data:image/webp;base64, ${string}` | `data:font/woff;base64, ${string}` | `data:font/woff2;base64, ${string}` | `data:application/xhtml+xml;base64, ${string}` | `data:application/vnd.ms-excel;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64, ${string}` | `data:text/xml;base64, ${string}` | `data:application/vnd.mozilla.xul+xml;base64, ${string}` | `data:application/yaml;base64, ${string}` | `data:application/zip;base64, ${string}` | `data:application/x-zip-compressed;base64, ${string}` | `data:video/3gpp;base64, ${string}` | `data:video/3gpp2;base64, ${string}` | `data:application/x-7z-compressed;base64, ${string}`;
264
- readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "mpd" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "webmanifest" | "doc" | "node" | "js" | "bin" | "obj" | "ogx" | "pdf" | "rtf" | "sql" | "toml" | "azw" | "mpkg" | "m3u8" | "pkpass" | "xul" | "xls" | "eot" | "ppt" | "odp" | "ods" | "odt" | "pptx" | "xlsx" | "docx" | "rar" | "vsd" | "wasm" | "7z" | "abw" | "bz" | "bz2" | "cda" | "csh" | "arc" | "php" | "mdx" | "ndjson" | "pyc" | "sh" | "tar" | "zip" | "xhtml" | "xml" | "mtlx" | "yml" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "weba" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "jpe" | "jif" | "jfif" | "pjp" | "pjpeg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "cur" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "html" | "htm" | "mjs" | "cjs" | "md" | "txt" | "rs" | "ts" | "vtt" | "py" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "webm" | "avi";
306
+ readonly b64encodedData: `data:application/octet-stream;base64, ${string}` | `data:audio/aac;base64, ${string}` | `data:application/x-abiword;base64, ${string}` | `data:image/aces;base64, ${string}` | `data:image/apng;base64, ${string}` | `data:application/x-freearc;base64, ${string}` | `data:image/avci;base64, ${string}` | `data:image/avif;base64, ${string}` | `data:video/x-msvideo;base64, ${string}` | `data:application/vnd.amazon.ebook;base64, ${string}` | `data:multipart/voice-message;base64, ${string}` | `data:image/bmp;base64, ${string}` | `data:application/x-bzip;base64, ${string}` | `data:application/x-bzip2;base64, ${string}` | `data:application/x-cdf;base64, ${string}` | `data:application/node;base64, ${string}` | `data:text/javascript;base64, ${string}` | `data:application/x-csh;base64, ${string}` | `data:text/css;base64, ${string}` | `data:text/csv;base64, ${string}` | `data:image/x-icon;base64, ${string}` | `data:application/msword;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64, ${string}` | `data:image/dpx;base64, ${string}` | `data:image/emf;base64, ${string}` | `data:application/vnd.ms-fontobject;base64, ${string}` | `data:application/epub+zip;base64, ${string}` | `data:image/gif;base64, ${string}` | `data:model/gltf-binary;base64, ${string}` | `data:model/gltf+json;base64, ${string}` | `data:application/gzip;base64, ${string}` | `data:application/x-gzip;base64, ${string}` | `data:haptics/hjif;base64, ${string}` | `data:haptics/hmpg;base64, ${string}` | `data:text/html;base64, ${string}` | `data:image/vnd.microsoft.icon;base64, ${string}` | `data:text/calendar;base64, ${string}` | `data:haptics/ivs;base64, ${string}` | `data:application/java-archive;base64, ${string}` | `data:image/jpeg;base64, ${string}` | `data:application/json;base64, ${string}` | `data:application/ld+json;base64, ${string}` | `data:image/ktx;base64, ${string}` | `data:image/ktx2;base64, ${string}` | `data:application/vnd.apple.mpegurl;base64, ${string}` | `data:audio/mp4;base64, ${string}` | `data:video/mp4;base64, ${string}` | `data:text/markdown;base64, ${string}` | `data:application/x-mdx;base64, ${string}` | `data:audio/midi;base64, ${string}` | `data:audio/x-midi;base64, ${string}` | `data:audio/mpeg;base64, ${string}` | `data:application/dash+xml;base64, ${string}` | `data:video/mpeg;base64, ${string}` | `data:application/vnd.apple.installer+xml;base64, ${string}` | `data:application/xml;base64, ${string}` | `data:application/x-ndjson;base64, ${string}` | `data:model/obj;base64, ${string}` | `data:text/plain;base64, ${string}` | `data:application/vnd.oasis.opendocument.presentation;base64, ${string}` | `data:application/vnd.oasis.opendocument.spreadsheet;base64, ${string}` | `data:application/vnd.oasis.opendocument.text;base64, ${string}` | `data:audio/ogg;base64, ${string}` | `data:video/ogg;base64, ${string}` | `data:application/ogg;base64, ${string}` | `data:font/otf;base64, ${string}` | `data:image/png;base64, ${string}` | `data:application/pdf;base64, ${string}` | `data:application/x-httpd-php;base64, ${string}` | `data:application/vnd.apple.pkpass;base64, ${string}` | `data:application/vnd.ms-powerpoint;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.presentationml.presentation;base64, ${string}` | `data:text/x-python;base64, ${string}` | `data:application/x-python-code;base64, ${string}` | `data:application/vnd.rar;base64, ${string}` | `data:text/rust;base64, ${string}` | `data:application/rtf;base64, ${string}` | `data:application/x-sh;base64, ${string}` | `data:application/sql;base64, ${string}` | `data:text/event-stream;base64, ${string}` | `data:image/svg+xml;base64, ${string}` | `data:application/x-tar;base64, ${string}` | `data:image/tiff;base64, ${string}` | `data:application/toml;base64, ${string}` | `data:text/typescript;base64, ${string}` | `data:video/mp2t;base64, ${string}` | `data:video/vnd.dlna.mpeg-tts;base64, ${string}` | `data:application/font-sfnt;base64, ${string}` | `data:font/ttf;base64, ${string}` | `data:model/vnd.usdz+zip;base64, ${string}` | `data:application/vnd.visio;base64, ${string}` | `data:text/vtt;base64, ${string}` | `data:application/wasm;base64, ${string}` | `data:audio/wav;base64, ${string}` | `data:audio/webm;base64, ${string}` | `data:video/webm;base64, ${string}` | `data:application/manifest+json;base64, ${string}` | `data:image/webp;base64, ${string}` | `data:font/woff;base64, ${string}` | `data:font/woff2;base64, ${string}` | `data:application/xhtml+xml;base64, ${string}` | `data:application/vnd.ms-excel;base64, ${string}` | `data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64, ${string}` | `data:text/xml;base64, ${string}` | `data:application/vnd.mozilla.xul+xml;base64, ${string}` | `data:application/yaml;base64, ${string}` | `data:application/zip;base64, ${string}` | `data:application/x-zip-compressed;base64, ${string}` | `data:video/3gpp;base64, ${string}` | `data:video/3gpp2;base64, ${string}` | `data:application/x-7z-compressed;base64, ${string}`;
307
+ readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avi" | "azw" | "bin" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "cur" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "jfif" | "jif" | "jpe" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpd" | "mpeg" | "mpkg" | "mtlx" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "pdf" | "php" | "pjp" | "pjpeg" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webm" | "webmanifest" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z";
265
308
  }>;
266
309
  assetToBufferView<const T extends string>(path: T): Promise<{
267
310
  readonly b64encodedData: string;
268
- readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "mpd" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "webmanifest" | "doc" | "node" | "js" | "bin" | "obj" | "ogx" | "pdf" | "rtf" | "sql" | "toml" | "azw" | "mpkg" | "m3u8" | "pkpass" | "xul" | "xls" | "eot" | "ppt" | "odp" | "ods" | "odt" | "pptx" | "xlsx" | "docx" | "rar" | "vsd" | "wasm" | "7z" | "abw" | "bz" | "bz2" | "cda" | "csh" | "arc" | "php" | "mdx" | "ndjson" | "pyc" | "sh" | "tar" | "zip" | "xhtml" | "xml" | "mtlx" | "yml" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "weba" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "jpe" | "jif" | "jfif" | "pjp" | "pjpeg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "cur" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "html" | "htm" | "mjs" | "cjs" | "md" | "txt" | "rs" | "ts" | "vtt" | "py" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "webm" | "avi" | undefined;
311
+ readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avi" | "azw" | "bin" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "cur" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "jfif" | "jif" | "jpe" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpd" | "mpeg" | "mpkg" | "mtlx" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "pdf" | "php" | "pjp" | "pjpeg" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webm" | "webmanifest" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
269
312
  }>;
270
313
  formatHelper<const T extends string>(f: T): string;
271
314
  cleanDataUrl<const C extends string>(props: C): string;
@@ -323,6 +366,9 @@ declare class Fs extends ImageService {
323
366
  options?: sharp.ResizeOptions;
324
367
  };
325
368
  }): Promise<Buffer<ArrayBufferLike>>;
369
+ existsTmp(path: string): boolean;
370
+ mkdirTmp(path: string, options?: MkDirSyncOptions): string | undefined;
371
+ generateDirIfDNETmp<const T extends string>(path: T, options?: MkDirSyncOptions): string | undefined;
326
372
  /**
327
373
  * Write data to a file in the system's tmp directory
328
374
  * @param filename The filename (can include subdirectories like "img-probe/file.txt")
@@ -338,6 +384,7 @@ declare class Fs extends ImageService {
338
384
  * ```
339
385
  */
340
386
  writeTmp<const F extends string>(filename: F, data: WriteStreamDataShape, options?: WriteStreamOptions): void;
387
+ writeTmpAsync<const F extends string>(filename: F, data: string, options?: WriteFileAsyncOptions): Promise<string | void>;
341
388
  readTmpAsync<const F extends string>(filename: F): Promise<Buffer<ArrayBufferLike>>;
342
389
  /**
343
390
  * Read a file from the tmp directory
package/dist/fs/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Fs
3
- } from "../chunk-3REIEDSC.js";
4
- import "../chunk-LFHV4PPA.js";
5
- import "../chunk-3WB2TSBO.js";
6
- import "../chunk-RJ2YQE3C.js";
7
- import "../chunk-QBG7TFHM.js";
8
- import "../chunk-IUGBPDQJ.js";
3
+ } from "../chunk-SYISQ57E.js";
4
+ import "../chunk-KUGIFRTF.js";
5
+ import "../chunk-GH6MFTV5.js";
6
+ import "../chunk-MRKO3PAA.js";
7
+ import "../chunk-6FJJLFJL.js";
8
+ import "../chunk-O2P3L3CJ.js";
9
9
  import "../chunk-7QVYU63E.js";
10
10
  export {
11
11
  Fs as default
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ImageService
3
- } from "../chunk-LFHV4PPA.js";
4
- import "../chunk-3WB2TSBO.js";
5
- import "../chunk-QBG7TFHM.js";
6
- import "../chunk-IUGBPDQJ.js";
3
+ } from "../chunk-KUGIFRTF.js";
4
+ import "../chunk-GH6MFTV5.js";
5
+ import "../chunk-6FJJLFJL.js";
6
+ import "../chunk-O2P3L3CJ.js";
7
7
  import "../chunk-7QVYU63E.js";
8
8
  export {
9
9
  ImageService
package/dist/index.d.ts CHANGED
@@ -2,8 +2,11 @@ export { default as Fs } from './fs/index.js';
2
2
  export { ImageService } from './image/index.js';
3
3
  export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, MimeType, MimeTypeToFileExtension, PresentMimeTopLevelTypes, extMimeMap, mimeToExt } from './mime/index.js';
4
4
  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, ImageSpecs, 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';
5
+ export { AsyncIter, Bin, Streamable, WebRS } from './types/stream.js';
5
6
  export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.js';
6
7
  export { UtilsService } from './utils/index.js';
8
+ import 'node:stream';
9
+ import 'stream/web';
7
10
  import 'dotenv-expand';
8
11
  import 'sharp';
9
12
  import 'stream';
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  Fs
3
- } from "./chunk-3REIEDSC.js";
3
+ } from "./chunk-SYISQ57E.js";
4
4
  import {
5
5
  ImageService
6
- } from "./chunk-LFHV4PPA.js";
6
+ } from "./chunk-KUGIFRTF.js";
7
7
  import {
8
8
  MimeService,
9
9
  extMimeMap,
10
10
  mimeToExt
11
- } from "./chunk-3WB2TSBO.js";
11
+ } from "./chunk-GH6MFTV5.js";
12
12
  import {
13
13
  unitsObj
14
- } from "./chunk-RJ2YQE3C.js";
14
+ } from "./chunk-MRKO3PAA.js";
15
15
  import {
16
16
  UrlService
17
- } from "./chunk-QBG7TFHM.js";
17
+ } from "./chunk-6FJJLFJL.js";
18
18
  import {
19
19
  UtilsService
20
- } from "./chunk-IUGBPDQJ.js";
20
+ } from "./chunk-O2P3L3CJ.js";
21
21
  import "./chunk-7QVYU63E.js";
22
22
  export {
23
23
  Fs,
@@ -487,16 +487,16 @@ declare class MimeService extends UrlService {
487
487
  compareMimeToExt(p?: "mime" | "ext"): {
488
488
  [k: string]: number;
489
489
  };
490
- mimeToExt(mime: keyof typeof this.toExtObj): "png" | "gif" | "bmp" | "webp" | "avif" | "mpd" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "webmanifest" | "doc" | "node" | "js" | "bin" | "obj" | "ogx" | "pdf" | "rtf" | "sql" | "toml" | "azw" | "mpkg" | "m3u8" | "pkpass" | "xul" | "xls" | "eot" | "ppt" | "odp" | "ods" | "odt" | "pptx" | "xlsx" | "docx" | "rar" | "vsd" | "wasm" | "7z" | "abw" | "bz" | "bz2" | "cda" | "csh" | "arc" | "php" | "mdx" | "ndjson" | "pyc" | "sh" | "tar" | "zip" | "xhtml" | "xml" | "yml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "wav" | "weba" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "ktx" | "ktx2" | "svg" | "tiff" | "ico" | "cur" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "html" | "md" | "txt" | "rs" | "ts" | "vtt" | "py" | "3gp" | "3g2" | "mp4" | "mpeg" | "ogv" | "webm" | "avi";
491
- assetType<const T extends string>(url: T): "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "mpd" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "webmanifest" | "doc" | "node" | "js" | "bin" | "obj" | "ogx" | "pdf" | "rtf" | "sql" | "toml" | "azw" | "mpkg" | "m3u8" | "pkpass" | "xul" | "xls" | "eot" | "ppt" | "odp" | "ods" | "odt" | "pptx" | "xlsx" | "docx" | "rar" | "vsd" | "wasm" | "7z" | "abw" | "bz" | "bz2" | "cda" | "csh" | "arc" | "php" | "mdx" | "ndjson" | "pyc" | "sh" | "tar" | "zip" | "xhtml" | "xml" | "mtlx" | "yml" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "weba" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "jpe" | "jif" | "jfif" | "pjp" | "pjpeg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "cur" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "html" | "htm" | "mjs" | "cjs" | "md" | "txt" | "rs" | "ts" | "vtt" | "py" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "webm" | "avi" | undefined;
490
+ mimeToExt(mime: keyof typeof this.toExtObj): "png" | "gif" | "bmp" | "webp" | "avif" | "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avi" | "azw" | "bin" | "bz" | "bz2" | "cda" | "csh" | "css" | "csv" | "cur" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "html" | "ico" | "ics" | "ivs" | "jar" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "md" | "mdx" | "mid" | "midi" | "mp3" | "mp4" | "mpd" | "mpeg" | "mpkg" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "ogv" | "ogx" | "opus" | "otf" | "pdf" | "php" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webm" | "webmanifest" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yml" | "zip" | "3gp" | "3g2" | "7z" | "ogg";
491
+ assetType<const T extends string>(url: T): "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avi" | "azw" | "bin" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "cur" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "jfif" | "jif" | "jpe" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpd" | "mpeg" | "mpkg" | "mtlx" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "pdf" | "php" | "pjp" | "pjpeg" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webm" | "webmanifest" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
492
492
  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", "multipart/voice-message"] | 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 ["image/x-icon"] | 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/gzip", "application/x-gzip"] | readonly ["haptics/hjif"] | readonly ["haptics/hmpg"] | readonly ["text/html"] | readonly ["image/vnd.microsoft.icon", "image/x-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 ["application/dash+xml"] | readonly ["video/mpeg"] | readonly ["application/vnd.apple.installer+xml"] | readonly ["application/xml"] | readonly ["application/x-ndjson"] | readonly ["model/obj", "application/octet-stream", "text/plain"] | 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 ["text/rust"] | readonly ["application/rtf"] | readonly ["application/x-sh"] | readonly ["application/sql"] | readonly ["text/event-stream"] | 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 ["audio/webm"] | readonly ["video/webm"] | readonly ["application/manifest+json"] | 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", "text/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"];
493
493
  getMimeFor<const E extends FileExtension>(ext: E, opts?: {
494
494
  type?: MimeTopLevelType;
495
495
  }): FileExtensionToMimeType<E>;
496
- 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" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "image/x-icon" | "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/gzip" | "application/x-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" | "application/dash+xml" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "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" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "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" | "audio/webm" | "video/webm" | "application/manifest+json" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
496
+ isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "image/x-icon" | "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/gzip" | "application/x-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" | "application/dash+xml" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "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" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "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" | "audio/webm" | "video/webm" | "application/manifest+json" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
497
497
  getMimeTypeForPath<T extends string>(path: T, opts?: {
498
498
  type?: MimeTopLevelType;
499
- }): "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" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "image/x-icon" | "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/gzip" | "application/x-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" | "application/dash+xml" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "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" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "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" | "audio/webm" | "video/webm" | "application/manifest+json" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
499
+ }): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "image/x-icon" | "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/gzip" | "application/x-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" | "application/dash+xml" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "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" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "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" | "audio/webm" | "video/webm" | "application/manifest+json" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
500
500
  }
501
501
 
502
502
  export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type MimeType, type MimeTypeToFileExtension, type PresentMimeTopLevelTypes, extMimeMap, mimeToExt };
@@ -2,9 +2,9 @@ import {
2
2
  MimeService,
3
3
  extMimeMap,
4
4
  mimeToExt
5
- } from "../chunk-3WB2TSBO.js";
6
- import "../chunk-QBG7TFHM.js";
7
- import "../chunk-IUGBPDQJ.js";
5
+ } from "../chunk-GH6MFTV5.js";
6
+ import "../chunk-6FJJLFJL.js";
7
+ import "../chunk-O2P3L3CJ.js";
8
8
  import "../chunk-7QVYU63E.js";
9
9
  export {
10
10
  MimeService,
@@ -100,7 +100,7 @@ type WriteStreamOptions = BufferEncodingUnion | {
100
100
  };
101
101
  type WriteFileAsyncDataUnion = WithImplicitCoercion<string> | {
102
102
  [Symbol.toPrimitive](hint: "string"): string;
103
- };
103
+ } | string;
104
104
  interface ReadDirOptionsEntity extends ObjEncodingOptions {
105
105
  withFileTypes?: false | undefined;
106
106
  recursive?: boolean | undefined;
@@ -108,10 +108,10 @@ interface ReadDirOptionsEntity extends ObjEncodingOptions {
108
108
  type ReadDirOptions = {
109
109
  [P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P];
110
110
  };
111
- type WriteFileAsyncOptions = (ObjEncodingOptions & {
111
+ type WriteFileAsyncOptions = ((ObjEncodingOptions & {
112
112
  mode?: Mode | undefined;
113
113
  flag?: OpenMode | undefined;
114
- } & Abortable) | BufferEncodingUnion | null;
114
+ } & Abortable) | BufferEncodingUnion | null);
115
115
  type WriteFileAsyncProps<T extends string = string> = {
116
116
  path: T;
117
117
  cwd: string;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unitsObj
3
- } from "../chunk-RJ2YQE3C.js";
3
+ } from "../chunk-MRKO3PAA.js";
4
4
  import "../chunk-7QVYU63E.js";
5
5
  export {
6
6
  unitsObj