@d0paminedriven/fs 7.0.1 → 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.
- package/dist/{chunk-QBG7TFHM.js → chunk-6FJJLFJL.js} +2 -2
- package/dist/{chunk-CN45SMBB.js → chunk-GH6MFTV5.js} +27 -12
- package/dist/chunk-KUGIFRTF.js +577 -0
- package/dist/{chunk-G27YIWW7.js → chunk-MRKO3PAA.js} +1 -1
- package/dist/{chunk-IUGBPDQJ.js → chunk-O2P3L3CJ.js} +1 -1
- package/dist/{chunk-CTA73JRX.js → chunk-SYISQ57E.js} +184 -427
- package/dist/fs/index.d.ts +204 -85
- package/dist/fs/index.js +6 -5
- package/dist/image/index.d.ts +88 -0
- package/dist/image/index.js +11 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +9 -5
- package/dist/mime/index.d.ts +51 -21
- package/dist/mime/index.js +3 -3
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +1 -1
- package/dist/types/stream.d.ts +9 -0
- package/dist/types/stream.js +1 -0
- package/dist/url/index.js +2 -2
- package/dist/utils/index.js +1 -1
- package/package.json +11 -3
- package/dist/fs/index.cjs +0 -1630
- package/dist/fs/index.d.cts +0 -392
- package/dist/index.cjs +0 -1648
- package/dist/index.d.cts +0 -9
- package/dist/mime/index.cjs +0 -494
- package/dist/mime/index.d.cts +0 -472
- package/dist/types/index.cjs +0 -38
- package/dist/types/index.d.cts +0 -333
- package/dist/url/index.cjs +0 -181
- package/dist/url/index.d.cts +0 -33
- package/dist/utils/index.cjs +0 -157
- package/dist/utils/index.d.cts +0 -25
package/dist/fs/index.d.ts
CHANGED
|
@@ -1,19 +1,209 @@
|
|
|
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';
|
|
4
|
-
import {
|
|
6
|
+
import { Streamable, AsyncIter } from '../types/stream.js';
|
|
7
|
+
import { ImageService } from '../image/index.js';
|
|
8
|
+
import '../mime/index.js';
|
|
5
9
|
import '../url/index.js';
|
|
6
10
|
import '../utils/index.js';
|
|
7
11
|
import 'stream';
|
|
8
12
|
import 'buffer';
|
|
9
13
|
|
|
10
|
-
declare class Fs extends
|
|
14
|
+
declare class Fs extends ImageService {
|
|
11
15
|
cwd: string;
|
|
12
16
|
constructor(cwd: string);
|
|
17
|
+
getImageSpecs(filePath: string): Promise<{
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
format: "png";
|
|
21
|
+
frames: number;
|
|
22
|
+
animated: boolean;
|
|
23
|
+
hasAlpha: boolean;
|
|
24
|
+
orientation: null;
|
|
25
|
+
aspectRatio: number;
|
|
26
|
+
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
|
|
27
|
+
iccProfile: string | null;
|
|
28
|
+
exifDateTimeOriginal: string | null;
|
|
29
|
+
} | {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
format: "jpeg";
|
|
33
|
+
frames: number;
|
|
34
|
+
animated: false;
|
|
35
|
+
hasAlpha: false;
|
|
36
|
+
orientation: number | null;
|
|
37
|
+
aspectRatio: number;
|
|
38
|
+
colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
|
|
39
|
+
iccProfile: string | null;
|
|
40
|
+
exifDateTimeOriginal: string | null;
|
|
41
|
+
} | {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
format: "gif";
|
|
45
|
+
frames: number;
|
|
46
|
+
animated: boolean;
|
|
47
|
+
hasAlpha: null;
|
|
48
|
+
orientation: null;
|
|
49
|
+
aspectRatio: number;
|
|
50
|
+
colorSpace: "indexed";
|
|
51
|
+
iccProfile: null;
|
|
52
|
+
exifDateTimeOriginal: null;
|
|
53
|
+
} | {
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
format: "bmp";
|
|
57
|
+
frames: number;
|
|
58
|
+
animated: false;
|
|
59
|
+
hasAlpha: null;
|
|
60
|
+
orientation: number;
|
|
61
|
+
aspectRatio: number;
|
|
62
|
+
colorSpace: "rgb" | "indexed";
|
|
63
|
+
iccProfile: null;
|
|
64
|
+
exifDateTimeOriginal: null;
|
|
65
|
+
} | {
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
format: "webp";
|
|
69
|
+
frames: number;
|
|
70
|
+
animated: boolean;
|
|
71
|
+
hasAlpha: boolean;
|
|
72
|
+
orientation: null;
|
|
73
|
+
aspectRatio: number;
|
|
74
|
+
colorSpace: "unknown" | "rgb" | "rgba";
|
|
75
|
+
iccProfile: string | null;
|
|
76
|
+
exifDateTimeOriginal: null;
|
|
77
|
+
} | {
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
format: "avif";
|
|
81
|
+
frames: number;
|
|
82
|
+
animated: boolean;
|
|
83
|
+
hasAlpha: true | null;
|
|
84
|
+
orientation: null;
|
|
85
|
+
aspectRatio: number;
|
|
86
|
+
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
|
|
87
|
+
iccProfile: string | null;
|
|
88
|
+
exifDateTimeOriginal: string | null;
|
|
89
|
+
}>;
|
|
90
|
+
getImageSpecsTmp(target: string): Promise<{
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
format: "png";
|
|
94
|
+
frames: number;
|
|
95
|
+
animated: boolean;
|
|
96
|
+
hasAlpha: boolean;
|
|
97
|
+
orientation: null;
|
|
98
|
+
aspectRatio: number;
|
|
99
|
+
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
|
|
100
|
+
iccProfile: string | null;
|
|
101
|
+
exifDateTimeOriginal: string | null;
|
|
102
|
+
} | {
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
format: "jpeg";
|
|
106
|
+
frames: number;
|
|
107
|
+
animated: false;
|
|
108
|
+
hasAlpha: false;
|
|
109
|
+
orientation: number | null;
|
|
110
|
+
aspectRatio: number;
|
|
111
|
+
colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
|
|
112
|
+
iccProfile: string | null;
|
|
113
|
+
exifDateTimeOriginal: string | null;
|
|
114
|
+
} | {
|
|
115
|
+
width: number;
|
|
116
|
+
height: number;
|
|
117
|
+
format: "gif";
|
|
118
|
+
frames: number;
|
|
119
|
+
animated: boolean;
|
|
120
|
+
hasAlpha: null;
|
|
121
|
+
orientation: null;
|
|
122
|
+
aspectRatio: number;
|
|
123
|
+
colorSpace: "indexed";
|
|
124
|
+
iccProfile: null;
|
|
125
|
+
exifDateTimeOriginal: null;
|
|
126
|
+
} | {
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
format: "bmp";
|
|
130
|
+
frames: number;
|
|
131
|
+
animated: false;
|
|
132
|
+
hasAlpha: null;
|
|
133
|
+
orientation: number;
|
|
134
|
+
aspectRatio: number;
|
|
135
|
+
colorSpace: "rgb" | "indexed";
|
|
136
|
+
iccProfile: null;
|
|
137
|
+
exifDateTimeOriginal: null;
|
|
138
|
+
} | {
|
|
139
|
+
width: number;
|
|
140
|
+
height: number;
|
|
141
|
+
format: "webp";
|
|
142
|
+
frames: number;
|
|
143
|
+
animated: boolean;
|
|
144
|
+
hasAlpha: boolean;
|
|
145
|
+
orientation: null;
|
|
146
|
+
aspectRatio: number;
|
|
147
|
+
colorSpace: "unknown" | "rgb" | "rgba";
|
|
148
|
+
iccProfile: string | null;
|
|
149
|
+
exifDateTimeOriginal: null;
|
|
150
|
+
} | {
|
|
151
|
+
width: number;
|
|
152
|
+
height: number;
|
|
153
|
+
format: "avif";
|
|
154
|
+
frames: number;
|
|
155
|
+
animated: boolean;
|
|
156
|
+
hasAlpha: true | null;
|
|
157
|
+
orientation: null;
|
|
158
|
+
aspectRatio: number;
|
|
159
|
+
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
|
|
160
|
+
iccProfile: string | null;
|
|
161
|
+
exifDateTimeOriginal: string | null;
|
|
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>;
|
|
13
198
|
private get myEnv();
|
|
14
199
|
get tmpDir(): string;
|
|
15
200
|
get tmpDirRelative(): string;
|
|
16
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;
|
|
17
207
|
/**
|
|
18
208
|
*
|
|
19
209
|
* @param target path to the file or directory to check for existence
|
|
@@ -113,12 +303,12 @@ declare class Fs extends MimeService {
|
|
|
113
303
|
fileToBufferAsync: <const T extends string>(path: T) => Promise<Buffer<ArrayBufferLike>>;
|
|
114
304
|
dirContainsDir<const From extends string, const To extends string>(readDir: From, targetDir: To, options?: ReadDirOptions): boolean;
|
|
115
305
|
assetToBuffer<const T extends string>(path: T): Promise<{
|
|
116
|
-
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:
|
|
117
|
-
readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "
|
|
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";
|
|
118
308
|
}>;
|
|
119
309
|
assetToBufferView<const T extends string>(path: T): Promise<{
|
|
120
310
|
readonly b64encodedData: string;
|
|
121
|
-
readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "
|
|
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;
|
|
122
312
|
}>;
|
|
123
313
|
formatHelper<const T extends string>(f: T): string;
|
|
124
314
|
cleanDataUrl<const C extends string>(props: C): string;
|
|
@@ -135,10 +325,7 @@ declare class Fs extends MimeService {
|
|
|
135
325
|
* ✅ 'public/assets/image-1.png'
|
|
136
326
|
*/
|
|
137
327
|
fetchRemoteWriteLocal<const I extends string, const O extends string>(inputUrl: I, outputPath: O, useDetectedExtension?: boolean): Promise<void>;
|
|
138
|
-
|
|
139
|
-
orientation: number | null;
|
|
140
|
-
dateTimeOriginal: string | null;
|
|
141
|
-
};
|
|
328
|
+
private knownToBlockHead;
|
|
142
329
|
/**
|
|
143
330
|
*
|
|
144
331
|
* @param inputUrl remote url to fetch data from
|
|
@@ -152,84 +339,11 @@ declare class Fs extends MimeService {
|
|
|
152
339
|
* ✅ 'public/assets/image-1.png'
|
|
153
340
|
*
|
|
154
341
|
* @description
|
|
155
|
-
* This method is designed for
|
|
156
|
-
*
|
|
342
|
+
* This method is designed for all files regardless of size, but especially for
|
|
343
|
+
* larger files that may not fit into memory (it intelligently determines the best approach on the fly)
|
|
344
|
+
* For files > 100 MB, it streams the data directly to disk instead of loading it all into memory
|
|
157
345
|
*/
|
|
158
346
|
fetchRemoteWriteLocalLargeFiles<const I extends string, const O extends string>(inputUrl: I, outputPathI: O, useDetectedExtension?: boolean): Promise<void>;
|
|
159
|
-
private findBox;
|
|
160
|
-
getImageSpecs(filePath: string): Promise<{
|
|
161
|
-
width: number;
|
|
162
|
-
height: number;
|
|
163
|
-
format: "png";
|
|
164
|
-
frames: number;
|
|
165
|
-
animated: boolean;
|
|
166
|
-
hasAlpha: boolean;
|
|
167
|
-
orientation: null;
|
|
168
|
-
aspectRatio: number;
|
|
169
|
-
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
|
|
170
|
-
iccProfile: string | null;
|
|
171
|
-
exifDateTimeOriginal: string | null;
|
|
172
|
-
} | {
|
|
173
|
-
width: number;
|
|
174
|
-
height: number;
|
|
175
|
-
format: "jpeg";
|
|
176
|
-
frames: number;
|
|
177
|
-
animated: false;
|
|
178
|
-
hasAlpha: false;
|
|
179
|
-
orientation: number | null;
|
|
180
|
-
aspectRatio: number;
|
|
181
|
-
colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
|
|
182
|
-
iccProfile: string | null;
|
|
183
|
-
exifDateTimeOriginal: string | null;
|
|
184
|
-
} | {
|
|
185
|
-
width: number;
|
|
186
|
-
height: number;
|
|
187
|
-
format: "gif";
|
|
188
|
-
frames: number;
|
|
189
|
-
animated: boolean;
|
|
190
|
-
hasAlpha: null;
|
|
191
|
-
orientation: null;
|
|
192
|
-
aspectRatio: number;
|
|
193
|
-
colorSpace: "indexed";
|
|
194
|
-
iccProfile: null;
|
|
195
|
-
exifDateTimeOriginal: null;
|
|
196
|
-
} | {
|
|
197
|
-
width: number;
|
|
198
|
-
height: number;
|
|
199
|
-
format: "bmp";
|
|
200
|
-
frames: number;
|
|
201
|
-
animated: false;
|
|
202
|
-
hasAlpha: null;
|
|
203
|
-
orientation: number;
|
|
204
|
-
aspectRatio: number;
|
|
205
|
-
colorSpace: "rgb" | "indexed";
|
|
206
|
-
iccProfile: null;
|
|
207
|
-
exifDateTimeOriginal: null;
|
|
208
|
-
} | {
|
|
209
|
-
width: number;
|
|
210
|
-
height: number;
|
|
211
|
-
format: "webp";
|
|
212
|
-
frames: number;
|
|
213
|
-
animated: boolean;
|
|
214
|
-
hasAlpha: boolean;
|
|
215
|
-
orientation: null;
|
|
216
|
-
aspectRatio: number;
|
|
217
|
-
colorSpace: "unknown" | "rgb" | "rgba";
|
|
218
|
-
iccProfile: string | null;
|
|
219
|
-
exifDateTimeOriginal: null;
|
|
220
|
-
} | {
|
|
221
|
-
width: number;
|
|
222
|
-
height: number;
|
|
223
|
-
format: "avif";
|
|
224
|
-
frames: number;
|
|
225
|
-
animated: boolean;
|
|
226
|
-
hasAlpha: true | null;
|
|
227
|
-
orientation: null;
|
|
228
|
-
aspectRatio: number;
|
|
229
|
-
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale-alpha" | "ycbcr" | "ycck";
|
|
230
|
-
iccProfile: string | null;
|
|
231
|
-
exifDateTimeOriginal: null;
|
|
232
|
-
}>;
|
|
233
347
|
/**
|
|
234
348
|
*
|
|
235
349
|
* @access package-private
|
|
@@ -252,6 +366,9 @@ declare class Fs extends MimeService {
|
|
|
252
366
|
options?: sharp.ResizeOptions;
|
|
253
367
|
};
|
|
254
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;
|
|
255
372
|
/**
|
|
256
373
|
* Write data to a file in the system's tmp directory
|
|
257
374
|
* @param filename The filename (can include subdirectories like "img-probe/file.txt")
|
|
@@ -267,6 +384,8 @@ declare class Fs extends MimeService {
|
|
|
267
384
|
* ```
|
|
268
385
|
*/
|
|
269
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>;
|
|
388
|
+
readTmpAsync<const F extends string>(filename: F): Promise<Buffer<ArrayBufferLike>>;
|
|
270
389
|
/**
|
|
271
390
|
* Read a file from the tmp directory
|
|
272
391
|
* @param filename The filename to read (can include subdirectories)
|
package/dist/fs/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fs
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
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";
|
|
8
9
|
import "../chunk-7QVYU63E.js";
|
|
9
10
|
export {
|
|
10
11
|
Fs as default
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { MimeService } from '../mime/index.js';
|
|
2
|
+
import '../types/index.js';
|
|
3
|
+
import 'stream';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
import '../url/index.js';
|
|
6
|
+
import '../utils/index.js';
|
|
7
|
+
|
|
8
|
+
declare class ImageService extends MimeService {
|
|
9
|
+
private parseExif;
|
|
10
|
+
private parseXmpFromAvif;
|
|
11
|
+
private readVarSize;
|
|
12
|
+
private findBox;
|
|
13
|
+
getImageSpecsWorkup(buffer: Buffer<ArrayBufferLike>): {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
format: "png";
|
|
17
|
+
frames: number;
|
|
18
|
+
animated: boolean;
|
|
19
|
+
hasAlpha: boolean;
|
|
20
|
+
orientation: null;
|
|
21
|
+
aspectRatio: number;
|
|
22
|
+
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
|
|
23
|
+
iccProfile: string | null;
|
|
24
|
+
exifDateTimeOriginal: string | null;
|
|
25
|
+
} | {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
format: "jpeg";
|
|
29
|
+
frames: number;
|
|
30
|
+
animated: false;
|
|
31
|
+
hasAlpha: false;
|
|
32
|
+
orientation: number | null;
|
|
33
|
+
aspectRatio: number;
|
|
34
|
+
colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
|
|
35
|
+
iccProfile: string | null;
|
|
36
|
+
exifDateTimeOriginal: string | null;
|
|
37
|
+
} | {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
format: "gif";
|
|
41
|
+
frames: number;
|
|
42
|
+
animated: boolean;
|
|
43
|
+
hasAlpha: null;
|
|
44
|
+
orientation: null;
|
|
45
|
+
aspectRatio: number;
|
|
46
|
+
colorSpace: "indexed";
|
|
47
|
+
iccProfile: null;
|
|
48
|
+
exifDateTimeOriginal: null;
|
|
49
|
+
} | {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
format: "bmp";
|
|
53
|
+
frames: number;
|
|
54
|
+
animated: false;
|
|
55
|
+
hasAlpha: null;
|
|
56
|
+
orientation: number;
|
|
57
|
+
aspectRatio: number;
|
|
58
|
+
colorSpace: "rgb" | "indexed";
|
|
59
|
+
iccProfile: null;
|
|
60
|
+
exifDateTimeOriginal: null;
|
|
61
|
+
} | {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
format: "webp";
|
|
65
|
+
frames: number;
|
|
66
|
+
animated: boolean;
|
|
67
|
+
hasAlpha: boolean;
|
|
68
|
+
orientation: null;
|
|
69
|
+
aspectRatio: number;
|
|
70
|
+
colorSpace: "unknown" | "rgb" | "rgba";
|
|
71
|
+
iccProfile: string | null;
|
|
72
|
+
exifDateTimeOriginal: null;
|
|
73
|
+
} | {
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
format: "avif";
|
|
77
|
+
frames: number;
|
|
78
|
+
animated: boolean;
|
|
79
|
+
hasAlpha: true | null;
|
|
80
|
+
orientation: null;
|
|
81
|
+
aspectRatio: number;
|
|
82
|
+
colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
|
|
83
|
+
iccProfile: string | null;
|
|
84
|
+
exifDateTimeOriginal: string | null;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { ImageService };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.js';
|
|
2
|
+
export { ImageService } from './image/index.js';
|
|
2
3
|
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, MimeType, MimeTypeToFileExtension, PresentMimeTopLevelTypes, extMimeMap, mimeToExt } from './mime/index.js';
|
|
3
|
-
export { Abortable, ArrFieldReplacer, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BoxInfo, BufferEncodingUnion, CTR, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, DX, DeepPartial, DeepPartialFields, DeepReplace, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType,
|
|
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';
|
|
4
6
|
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.js';
|
|
5
7
|
export { UtilsService } from './utils/index.js';
|
|
8
|
+
import 'node:stream';
|
|
9
|
+
import 'stream/web';
|
|
6
10
|
import 'dotenv-expand';
|
|
7
11
|
import 'sharp';
|
|
8
12
|
import 'stream';
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SYISQ57E.js";
|
|
4
|
+
import {
|
|
5
|
+
ImageService
|
|
6
|
+
} from "./chunk-KUGIFRTF.js";
|
|
4
7
|
import {
|
|
5
8
|
MimeService,
|
|
6
9
|
extMimeMap,
|
|
7
10
|
mimeToExt
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GH6MFTV5.js";
|
|
9
12
|
import {
|
|
10
13
|
unitsObj
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MRKO3PAA.js";
|
|
12
15
|
import {
|
|
13
16
|
UrlService
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6FJJLFJL.js";
|
|
15
18
|
import {
|
|
16
19
|
UtilsService
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-O2P3L3CJ.js";
|
|
18
21
|
import "./chunk-7QVYU63E.js";
|
|
19
22
|
export {
|
|
20
23
|
Fs,
|
|
24
|
+
ImageService,
|
|
21
25
|
MimeService,
|
|
22
26
|
UrlService,
|
|
23
27
|
UtilsService,
|