@d0paminedriven/fs 7.2.0 → 7.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/README.md +104 -51
- package/dist/chunk-2IRCHZCF.js +75 -0
- package/dist/{chunk-KUGIFRTF.js → chunk-2XQ44ZWR.js} +339 -3
- package/dist/{chunk-O2P3L3CJ.js → chunk-6HHKXBIM.js} +5 -2
- package/dist/chunk-HPM4IQQR.js +69 -0
- package/dist/{chunk-GH6MFTV5.js → chunk-KNLXF622.js} +2 -2
- package/dist/chunk-KOKPGEU4.js +69 -0
- package/dist/chunk-LQP2FYMK.js +237 -0
- package/dist/chunk-NHYRCNMW.js +107 -0
- package/dist/chunk-NOOFSAF4.js +165 -0
- package/dist/chunk-PTXZQBLV.js +367 -0
- package/dist/{chunk-MRKO3PAA.js → chunk-R63XI7FS.js} +1 -1
- package/dist/{chunk-6FJJLFJL.js → chunk-UW52DMHT.js} +2 -2
- package/dist/chunk-Z2WZLZC4.js +75 -0
- package/dist/fs/index.d.ts +18 -329
- package/dist/fs/index.js +13 -6
- package/dist/fs-atomic/index.d.ts +38 -0
- package/dist/fs-atomic/index.js +14 -0
- package/dist/fs-base/index.d.ts +112 -0
- package/dist/fs-base/index.js +13 -0
- package/dist/fs-core/index.d.ts +24 -0
- package/dist/fs-core/index.js +17 -0
- package/dist/fs-fetch/index.d.ts +64 -0
- package/dist/fs-fetch/index.js +19 -0
- package/dist/fs-size/index.d.ts +30 -0
- package/dist/fs-size/index.js +16 -0
- package/dist/fs-tmp/index.d.ts +194 -0
- package/dist/fs-tmp/index.js +18 -0
- package/dist/image/index.d.ts +35 -1
- package/dist/image/index.js +5 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +36 -8
- package/dist/ld/index.d.ts +14 -0
- package/dist/ld/index.js +8 -0
- package/dist/mime/index.d.ts +5 -4
- package/dist/mime/index.js +4 -3
- package/dist/types/index.d.ts +13 -13
- package/dist/types/index.js +1 -1
- package/dist/url/index.d.ts +1 -0
- package/dist/url/index.js +3 -2
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/package.json +31 -3
- package/dist/chunk-SYISQ57E.js +0 -895
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FsTmp } from '../fs-tmp/index.js';
|
|
2
|
+
import '../types/index.js';
|
|
3
|
+
import 'stream';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
import '../fs-core/index.js';
|
|
6
|
+
import '../fs-size/index.js';
|
|
7
|
+
import '../fs-atomic/index.js';
|
|
8
|
+
import '../fs-base/index.js';
|
|
9
|
+
import 'node:stream';
|
|
10
|
+
import 'stream/web';
|
|
11
|
+
import 'dotenv-expand';
|
|
12
|
+
import '../types/stream.js';
|
|
13
|
+
import '../image/index.js';
|
|
14
|
+
import '../mime/index.js';
|
|
15
|
+
import '../url/index.js';
|
|
16
|
+
import '../utils/index.js';
|
|
17
|
+
import '../ld/index.js';
|
|
18
|
+
|
|
19
|
+
declare class FsFetch extends FsTmp {
|
|
20
|
+
cwd: string;
|
|
21
|
+
constructor(cwd: string);
|
|
22
|
+
assetToBuffer<const T extends string>(path: T): Promise<{
|
|
23
|
+
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}`;
|
|
24
|
+
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";
|
|
25
|
+
}>;
|
|
26
|
+
assetToBufferView<const T extends string>(path: T): Promise<{
|
|
27
|
+
readonly b64encodedData: string;
|
|
28
|
+
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;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param inputUrl remote url to fetch data from
|
|
33
|
+
* @param outputPath desired output path relative to the cwd
|
|
34
|
+
* @param useDetectedExtension optional, defaults to true
|
|
35
|
+
*
|
|
36
|
+
* if `useDetectedExtension` is false you must include the file extension in your output path →
|
|
37
|
+
*
|
|
38
|
+
* 🚫 'public/assets/image-1'
|
|
39
|
+
*
|
|
40
|
+
* ✅ 'public/assets/image-1.png'
|
|
41
|
+
*/
|
|
42
|
+
fetchRemoteWriteLocal<const I extends string, const O extends string>(inputUrl: I, outputPath: O, useDetectedExtension?: boolean): Promise<void>;
|
|
43
|
+
private knownToBlockHead;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param inputUrl remote url to fetch data from
|
|
47
|
+
* @param outputPath desired output path relative to the cwd
|
|
48
|
+
* @param useDetectedExtension optional, defaults to true
|
|
49
|
+
*
|
|
50
|
+
* if `useDetectedExtension` is false you must include the file extension in your output path →
|
|
51
|
+
*
|
|
52
|
+
* 🚫 'public/assets/image-1'
|
|
53
|
+
*
|
|
54
|
+
* ✅ 'public/assets/image-1.png'
|
|
55
|
+
*
|
|
56
|
+
* @description
|
|
57
|
+
* This method is designed for all files regardless of size, but especially for
|
|
58
|
+
* larger files that may not fit into memory (it intelligently determines the best approach on the fly)
|
|
59
|
+
* For files > 100 MB, it streams the data directly to disk instead of loading it all into memory
|
|
60
|
+
*/
|
|
61
|
+
fetchRemoteWriteLocalLargeFiles<const I extends string, const O extends string>(inputUrl: I, outputPathI: O, useDetectedExtension?: boolean): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { FsFetch };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FsFetch
|
|
3
|
+
} from "../chunk-NOOFSAF4.js";
|
|
4
|
+
import "../chunk-PTXZQBLV.js";
|
|
5
|
+
import "../chunk-KOKPGEU4.js";
|
|
6
|
+
import "../chunk-2IRCHZCF.js";
|
|
7
|
+
import "../chunk-R63XI7FS.js";
|
|
8
|
+
import "../chunk-NHYRCNMW.js";
|
|
9
|
+
import "../chunk-LQP2FYMK.js";
|
|
10
|
+
import "../chunk-2XQ44ZWR.js";
|
|
11
|
+
import "../chunk-KNLXF622.js";
|
|
12
|
+
import "../chunk-UW52DMHT.js";
|
|
13
|
+
import "../chunk-6HHKXBIM.js";
|
|
14
|
+
import "../chunk-Z2WZLZC4.js";
|
|
15
|
+
import "../chunk-7QVYU63E.js";
|
|
16
|
+
export {
|
|
17
|
+
FsFetch
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Unit, SizeOpts } from '../types/index.js';
|
|
2
|
+
import { FsAtomic } from '../fs-atomic/index.js';
|
|
3
|
+
import 'stream';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
import '../fs-base/index.js';
|
|
6
|
+
import 'node:stream';
|
|
7
|
+
import 'stream/web';
|
|
8
|
+
import 'dotenv-expand';
|
|
9
|
+
import '../types/stream.js';
|
|
10
|
+
import '../image/index.js';
|
|
11
|
+
import '../mime/index.js';
|
|
12
|
+
import '../url/index.js';
|
|
13
|
+
import '../utils/index.js';
|
|
14
|
+
import '../ld/index.js';
|
|
15
|
+
|
|
16
|
+
declare class FsSize extends FsAtomic {
|
|
17
|
+
cwd: string;
|
|
18
|
+
constructor(cwd: string);
|
|
19
|
+
private units;
|
|
20
|
+
private u;
|
|
21
|
+
autoFileSizeRaw(size: number | bigint): {
|
|
22
|
+
value: number;
|
|
23
|
+
unit: "B" | "KB" | "MB" | "GB" | "TB" | "PB" | undefined;
|
|
24
|
+
};
|
|
25
|
+
getSize<const S extends Unit | Lowercase<Unit> | "auto">(size: number | bigint, target: S, opts?: SizeOpts): string | number;
|
|
26
|
+
fileSizeMb<const T extends string>(path: T): number;
|
|
27
|
+
fileSize<const T extends string, const S extends Unit | Lowercase<Unit> | "auto">(path: T, target: S, opts?: SizeOpts): string | number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { FsSize };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FsSize
|
|
3
|
+
} from "../chunk-2IRCHZCF.js";
|
|
4
|
+
import "../chunk-R63XI7FS.js";
|
|
5
|
+
import "../chunk-NHYRCNMW.js";
|
|
6
|
+
import "../chunk-LQP2FYMK.js";
|
|
7
|
+
import "../chunk-2XQ44ZWR.js";
|
|
8
|
+
import "../chunk-KNLXF622.js";
|
|
9
|
+
import "../chunk-UW52DMHT.js";
|
|
10
|
+
import "../chunk-6HHKXBIM.js";
|
|
11
|
+
import "../chunk-Z2WZLZC4.js";
|
|
12
|
+
import "../chunk-7QVYU63E.js";
|
|
13
|
+
export {
|
|
14
|
+
FsSize
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncOptions, ReadDirOptions } from '../types/index.js';
|
|
2
|
+
import { FsCore } from '../fs-core/index.js';
|
|
3
|
+
import { Streamable } from '../types/stream.js';
|
|
4
|
+
import 'stream';
|
|
5
|
+
import 'buffer';
|
|
6
|
+
import '../fs-size/index.js';
|
|
7
|
+
import '../fs-atomic/index.js';
|
|
8
|
+
import '../fs-base/index.js';
|
|
9
|
+
import 'node:stream';
|
|
10
|
+
import 'stream/web';
|
|
11
|
+
import 'dotenv-expand';
|
|
12
|
+
import '../image/index.js';
|
|
13
|
+
import '../mime/index.js';
|
|
14
|
+
import '../url/index.js';
|
|
15
|
+
import '../utils/index.js';
|
|
16
|
+
import '../ld/index.js';
|
|
17
|
+
|
|
18
|
+
declare class FsTmp extends FsCore {
|
|
19
|
+
cwd: string;
|
|
20
|
+
constructor(cwd: string);
|
|
21
|
+
/**
|
|
22
|
+
* Write data to a file in the system's tmp directory
|
|
23
|
+
* @param filename The filename (can include subdirectories like "img-probe/file.txt")
|
|
24
|
+
* @param data The data to write
|
|
25
|
+
* @param options Optional write stream options
|
|
26
|
+
* @returns The full path to the written file
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const fs = new Fs(process.cwd());
|
|
30
|
+
* const tmpPath = fs.writeTmp("session-data.json", JSON.stringify(data));
|
|
31
|
+
* // Or with a subdirectory:
|
|
32
|
+
* fs.writeTmp("img-probe/output.png", imageBuffer);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
writeTmp<const F extends string>(filename: F, data: WriteStreamDataShape, options?: WriteStreamOptions): void;
|
|
36
|
+
writeTmpAsync<const F extends string>(filename: F, data: string, options?: WriteFileAsyncOptions): Promise<string | void>;
|
|
37
|
+
readTmpAsync<const F extends string>(filename: F): Promise<Buffer<ArrayBufferLike>>;
|
|
38
|
+
/**
|
|
39
|
+
* Read a file from the tmp directory
|
|
40
|
+
* @param filename The filename to read (can include subdirectories)
|
|
41
|
+
* @returns Buffer containing the file data
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const fs = new Fs(process.cwd());
|
|
45
|
+
* const data = fs.readTmp("session-data.json");
|
|
46
|
+
* const parsed = JSON.parse(data.toString("utf-8"));
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
readTmp<const F extends string>(filename: F): Buffer<ArrayBuffer>;
|
|
50
|
+
/**
|
|
51
|
+
* Scan the tmp directory for files matching a pattern
|
|
52
|
+
* @param pattern Optional pattern to filter files (e.g., "img-probe")
|
|
53
|
+
* @param options Options for directory reading (defaults to non-recursive to avoid permission issues)
|
|
54
|
+
* @returns Array of matching file paths relative to tmp directory
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const fs = new Fs(process.cwd());
|
|
58
|
+
* // Get all img-probe files
|
|
59
|
+
* const imgFiles = fs.scanTmp("img-probe");
|
|
60
|
+
* // Get all files in tmp (non-recursive)
|
|
61
|
+
* const allFiles = fs.scanTmp();
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
scanTmp(pattern?: string | RegExp, options?: ReadDirOptions): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Extract specific files from tmp directory to a target location
|
|
67
|
+
* @param pattern Pattern to match files (e.g., "img-probe")
|
|
68
|
+
* @param targetDir Target directory to extract files to
|
|
69
|
+
* @param options Options for extraction behavior
|
|
70
|
+
* @returns Array of extracted file paths
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const fs = new Fs(process.cwd());
|
|
74
|
+
* // Extract all img-probe files to ./output
|
|
75
|
+
* const extracted = fs.extractFromTmp("img-probe", "./output");
|
|
76
|
+
* // Extract with custom behavior
|
|
77
|
+
* fs.extractFromTmp("session-", "./sessions", {
|
|
78
|
+
* preserveStructure: true,
|
|
79
|
+
* cleanupAfter: true
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
extractFromTmp(pattern: string, targetDir: string, options?: {
|
|
84
|
+
preserveStructure?: boolean;
|
|
85
|
+
cleanupAfter?: boolean;
|
|
86
|
+
overwrite?: boolean;
|
|
87
|
+
}): string[];
|
|
88
|
+
/**
|
|
89
|
+
* Clean up tmp files matching a pattern
|
|
90
|
+
* @param pattern Pattern to match files for deletion
|
|
91
|
+
* @param maxAge Optional max age in milliseconds (only delete files older than this)
|
|
92
|
+
* @returns Number of files removed
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const fs = new Fs(process.cwd());
|
|
96
|
+
* // Remove all img-probe files
|
|
97
|
+
* fs.cleanupTmp("img-probe");
|
|
98
|
+
* // Remove session files older than 1 hour
|
|
99
|
+
* fs.cleanupTmp("session-", 60 * 60 * 1000);
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
cleanupTmp(pattern: string, maxAge?: number): number;
|
|
103
|
+
/**
|
|
104
|
+
* Generate a unique tmp filename with optional prefix
|
|
105
|
+
* @param prefix Optional prefix for the filename
|
|
106
|
+
* @param extension Optional file extension (without dot)
|
|
107
|
+
* @returns Unique filename
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const fs = new Fs(process.cwd());
|
|
111
|
+
* const filename = fs.uniqueTmpName("img-probe", "png");
|
|
112
|
+
* // Returns: "img-probe-1701234567890-a3b2c1.png"
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
uniqueTmpName(prefix?: string, extension?: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Async generator for cleaning tmp files with batched removal
|
|
118
|
+
* @param pattern Pattern to match files for deletion
|
|
119
|
+
* @param batchSize Number of files to remove per batch (default 10)
|
|
120
|
+
* @yields Progress information during cleanup
|
|
121
|
+
* @returns Final cleanup summary
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const fs = new Fs(process.cwd());
|
|
125
|
+
* // Clean up with progress tracking
|
|
126
|
+
* for await (const progress of fs.cleanTmpGenerator("session-", 25)) {
|
|
127
|
+
* console.log(progress);
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
cleanTmpGenerator(pattern: string | RegExp, batchSize?: number): AsyncGenerator<{
|
|
132
|
+
action: "removing";
|
|
133
|
+
batch: string[];
|
|
134
|
+
batchNumber: number;
|
|
135
|
+
totalBatches: number;
|
|
136
|
+
totalFound: number;
|
|
137
|
+
removed: number;
|
|
138
|
+
batchSize?: undefined;
|
|
139
|
+
totalRemoved?: undefined;
|
|
140
|
+
remaining?: undefined;
|
|
141
|
+
} | {
|
|
142
|
+
action: "batch-complete";
|
|
143
|
+
batchNumber: number;
|
|
144
|
+
batchSize: number;
|
|
145
|
+
totalRemoved: number;
|
|
146
|
+
remaining: number;
|
|
147
|
+
batch?: undefined;
|
|
148
|
+
totalBatches?: undefined;
|
|
149
|
+
totalFound?: undefined;
|
|
150
|
+
removed?: undefined;
|
|
151
|
+
}, {
|
|
152
|
+
action: "complete";
|
|
153
|
+
totalRemoved: number;
|
|
154
|
+
totalBatches: number;
|
|
155
|
+
pattern: string;
|
|
156
|
+
}, unknown>;
|
|
157
|
+
/**
|
|
158
|
+
* Async version of withWs with atomic write support and progress tracking
|
|
159
|
+
* @param path Target file path
|
|
160
|
+
* @param data Streamable data to write
|
|
161
|
+
* @param options Optional atomic write and abort signal
|
|
162
|
+
* @returns Promise with path and bytes written
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const fs = new Fs(process.cwd());
|
|
166
|
+
* // Simple async write
|
|
167
|
+
* const result = await fs.asyncWithWs("output.txt", "Hello World");
|
|
168
|
+
* console.log(`Wrote ${result.bytes} bytes to ${result.path}`);
|
|
169
|
+
*
|
|
170
|
+
* // Atomic write with temp file
|
|
171
|
+
* const { path, bytes } = await fs.asyncWithWs(
|
|
172
|
+
* "critical-data.json",
|
|
173
|
+
* JSON.stringify(data),
|
|
174
|
+
* { atomic: true }
|
|
175
|
+
* );
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
asyncWithWs(path: string, data: Streamable, options?: {
|
|
179
|
+
atomic?: boolean;
|
|
180
|
+
signal?: AbortSignal;
|
|
181
|
+
}): Promise<string | {
|
|
182
|
+
path: string;
|
|
183
|
+
bytes: number;
|
|
184
|
+
newPath?: undefined;
|
|
185
|
+
newBytes?: undefined;
|
|
186
|
+
} | {
|
|
187
|
+
path: string;
|
|
188
|
+
bytes: number;
|
|
189
|
+
newPath: string;
|
|
190
|
+
newBytes: number;
|
|
191
|
+
} | undefined>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { FsTmp };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FsTmp
|
|
3
|
+
} from "../chunk-PTXZQBLV.js";
|
|
4
|
+
import "../chunk-KOKPGEU4.js";
|
|
5
|
+
import "../chunk-2IRCHZCF.js";
|
|
6
|
+
import "../chunk-R63XI7FS.js";
|
|
7
|
+
import "../chunk-NHYRCNMW.js";
|
|
8
|
+
import "../chunk-LQP2FYMK.js";
|
|
9
|
+
import "../chunk-2XQ44ZWR.js";
|
|
10
|
+
import "../chunk-KNLXF622.js";
|
|
11
|
+
import "../chunk-UW52DMHT.js";
|
|
12
|
+
import "../chunk-6HHKXBIM.js";
|
|
13
|
+
import "../chunk-Z2WZLZC4.js";
|
|
14
|
+
import "../chunk-7QVYU63E.js";
|
|
15
|
+
export {
|
|
16
|
+
FsTmp
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/dist/image/index.d.ts
CHANGED
|
@@ -1,15 +1,49 @@
|
|
|
1
|
+
import { ImageSpecs } from '../types/index.js';
|
|
1
2
|
import { MimeService } from '../mime/index.js';
|
|
2
|
-
import '
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
3
4
|
import 'stream';
|
|
4
5
|
import 'buffer';
|
|
5
6
|
import '../url/index.js';
|
|
6
7
|
import '../utils/index.js';
|
|
8
|
+
import '../ld/index.js';
|
|
7
9
|
|
|
8
10
|
declare class ImageService extends MimeService {
|
|
11
|
+
cwd: string;
|
|
12
|
+
constructor(cwd: string);
|
|
13
|
+
/**
|
|
14
|
+
* Read exactly N bytes from a stream, returning a Buffer
|
|
15
|
+
* Closes stream after reading or on error
|
|
16
|
+
*/
|
|
17
|
+
private readBytes;
|
|
18
|
+
/**
|
|
19
|
+
* Extract image metadata from a stream, reading only ~4KB for most formats
|
|
20
|
+
* Automatically handles PNG, JPEG, GIF, BMP, WebP, and AVIF
|
|
21
|
+
*/
|
|
22
|
+
extractFromStream(stream: Readable): Promise<ImageSpecs>;
|
|
23
|
+
/**
|
|
24
|
+
* Extract metadata from file path using streaming (memory efficient)
|
|
25
|
+
*/
|
|
26
|
+
extractFromPath(filePath: string): Promise<ImageSpecs>;
|
|
27
|
+
private isPNG;
|
|
28
|
+
private isJPEG;
|
|
29
|
+
private isGIF;
|
|
30
|
+
private isBMP;
|
|
31
|
+
private isWebP;
|
|
32
|
+
private isAVIF;
|
|
33
|
+
private extractPNGFromBuffer;
|
|
34
|
+
private extractJPEGFromBuffer;
|
|
35
|
+
private extractGIFFromBuffer;
|
|
36
|
+
private extractBMPFromBuffer;
|
|
37
|
+
private extractWebPFromBuffer;
|
|
38
|
+
private extractAVIFFromBuffer;
|
|
9
39
|
private parseExif;
|
|
10
40
|
private parseXmpFromAvif;
|
|
11
41
|
private readVarSize;
|
|
12
42
|
private findBox;
|
|
43
|
+
/**
|
|
44
|
+
* Legacy method that processes entire buffer
|
|
45
|
+
* Use extractFromStream or extractFromPath for better memory efficiency
|
|
46
|
+
*/
|
|
13
47
|
getImageSpecsWorkup(buffer: Buffer<ArrayBufferLike>): {
|
|
14
48
|
width: number;
|
|
15
49
|
height: number;
|
package/dist/image/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImageService
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-2XQ44ZWR.js";
|
|
4
|
+
import "../chunk-KNLXF622.js";
|
|
5
|
+
import "../chunk-UW52DMHT.js";
|
|
6
|
+
import "../chunk-6HHKXBIM.js";
|
|
7
|
+
import "../chunk-Z2WZLZC4.js";
|
|
7
8
|
import "../chunk-7QVYU63E.js";
|
|
8
9
|
export {
|
|
9
10
|
ImageService
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.js';
|
|
2
|
+
export { FsAtomic } from './fs-atomic/index.js';
|
|
3
|
+
export { FsBase } from './fs-base/index.js';
|
|
4
|
+
export { FsCore } from './fs-core/index.js';
|
|
5
|
+
export { FsFetch } from './fs-fetch/index.js';
|
|
6
|
+
export { FsSize } from './fs-size/index.js';
|
|
7
|
+
export { FsTmp } from './fs-tmp/index.js';
|
|
2
8
|
export { ImageService } from './image/index.js';
|
|
9
|
+
export { LevenshteinDistance } from './ld/index.js';
|
|
3
10
|
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, MimeType, MimeTypeToFileExtension, PresentMimeTopLevelTypes, extMimeMap, mimeToExt } from './mime/index.js';
|
|
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,
|
|
11
|
+
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, NoParamCallback, ObjEncodingOptions, OmitSrc, OnlyOptional, OnlyRequired, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, RTC, ReadDirOptions, ReadDirOptionsEntity, ReadDirProps, RemoveFields, RequireNested, RequiredToConditional, Rm, RmOptions, Signals, SizeOpts, StdioOptions, TCN, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.js';
|
|
5
12
|
export { AsyncIter, Bin, Streamable, WebRS } from './types/stream.js';
|
|
6
13
|
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.js';
|
|
7
14
|
export { UtilsService } from './utils/index.js';
|
|
8
|
-
import 'node:stream';
|
|
9
|
-
import 'stream/web';
|
|
10
|
-
import 'dotenv-expand';
|
|
11
15
|
import 'sharp';
|
|
12
16
|
import 'stream';
|
|
13
17
|
import 'buffer';
|
|
18
|
+
import 'node:stream';
|
|
19
|
+
import 'stream/web';
|
|
20
|
+
import 'dotenv-expand';
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HPM4IQQR.js";
|
|
4
|
+
import {
|
|
5
|
+
FsFetch
|
|
6
|
+
} from "./chunk-NOOFSAF4.js";
|
|
7
|
+
import {
|
|
8
|
+
FsTmp
|
|
9
|
+
} from "./chunk-PTXZQBLV.js";
|
|
10
|
+
import {
|
|
11
|
+
FsCore
|
|
12
|
+
} from "./chunk-KOKPGEU4.js";
|
|
13
|
+
import {
|
|
14
|
+
FsSize
|
|
15
|
+
} from "./chunk-2IRCHZCF.js";
|
|
16
|
+
import {
|
|
17
|
+
unitsObj
|
|
18
|
+
} from "./chunk-R63XI7FS.js";
|
|
19
|
+
import {
|
|
20
|
+
FsAtomic
|
|
21
|
+
} from "./chunk-NHYRCNMW.js";
|
|
22
|
+
import {
|
|
23
|
+
FsBase
|
|
24
|
+
} from "./chunk-LQP2FYMK.js";
|
|
4
25
|
import {
|
|
5
26
|
ImageService
|
|
6
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-2XQ44ZWR.js";
|
|
7
28
|
import {
|
|
8
29
|
MimeService,
|
|
9
30
|
extMimeMap,
|
|
10
31
|
mimeToExt
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
unitsObj
|
|
14
|
-
} from "./chunk-MRKO3PAA.js";
|
|
32
|
+
} from "./chunk-KNLXF622.js";
|
|
15
33
|
import {
|
|
16
34
|
UrlService
|
|
17
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-UW52DMHT.js";
|
|
18
36
|
import {
|
|
19
37
|
UtilsService
|
|
20
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6HHKXBIM.js";
|
|
39
|
+
import {
|
|
40
|
+
LevenshteinDistance
|
|
41
|
+
} from "./chunk-Z2WZLZC4.js";
|
|
21
42
|
import "./chunk-7QVYU63E.js";
|
|
22
43
|
export {
|
|
23
44
|
Fs,
|
|
45
|
+
FsAtomic,
|
|
46
|
+
FsBase,
|
|
47
|
+
FsCore,
|
|
48
|
+
FsFetch,
|
|
49
|
+
FsSize,
|
|
50
|
+
FsTmp,
|
|
24
51
|
ImageService,
|
|
52
|
+
LevenshteinDistance,
|
|
25
53
|
MimeService,
|
|
26
54
|
UrlService,
|
|
27
55
|
UtilsService,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class LevenshteinDistance {
|
|
2
|
+
private createMatrix;
|
|
3
|
+
private inBounds;
|
|
4
|
+
private getCell;
|
|
5
|
+
private setCell;
|
|
6
|
+
/**
|
|
7
|
+
* Computes the Levenshtein distance between two strings, i.e.,
|
|
8
|
+
* the minimum number of single-character edits (insertions,
|
|
9
|
+
* deletions, or substitutions) needed to transform `a` into `b`.
|
|
10
|
+
*/
|
|
11
|
+
calculate(a?: string | null, b?: string | null): number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { LevenshteinDistance };
|
package/dist/ld/index.js
ADDED
package/dist/mime/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { UrlService } from '../url/index.js';
|
|
|
3
3
|
import 'stream';
|
|
4
4
|
import 'buffer';
|
|
5
5
|
import '../utils/index.js';
|
|
6
|
+
import '../ld/index.js';
|
|
6
7
|
|
|
7
8
|
declare const extMimeMap: {
|
|
8
9
|
readonly aac: readonly ["audio/aac"];
|
|
@@ -487,16 +488,16 @@ declare class MimeService extends UrlService {
|
|
|
487
488
|
compareMimeToExt(p?: "mime" | "ext"): {
|
|
488
489
|
[k: string]: number;
|
|
489
490
|
};
|
|
490
|
-
mimeToExt(mime: keyof typeof this.toExtObj): "png" | "gif" | "bmp" | "webp" | "avif" | "
|
|
491
|
-
assetType<const T extends string>(url: T): "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "
|
|
491
|
+
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";
|
|
492
|
+
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;
|
|
492
493
|
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
494
|
getMimeFor<const E extends FileExtension>(ext: E, opts?: {
|
|
494
495
|
type?: MimeTopLevelType;
|
|
495
496
|
}): FileExtensionToMimeType<E>;
|
|
496
|
-
isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "
|
|
497
|
+
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;
|
|
497
498
|
getMimeTypeForPath<T extends string>(path: T, opts?: {
|
|
498
499
|
type?: MimeTopLevelType;
|
|
499
|
-
}): "
|
|
500
|
+
}): "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";
|
|
500
501
|
}
|
|
501
502
|
|
|
502
503
|
export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type MimeType, type MimeTypeToFileExtension, type PresentMimeTopLevelTypes, extMimeMap, mimeToExt };
|