@d0paminedriven/fs 7.0.1 → 7.1.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,15 +1,162 @@
1
1
  import expand from 'dotenv-expand';
2
2
  import sharp from 'sharp';
3
3
  import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, Unit, SizeOpts, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.cjs';
4
- import { MimeService } from '../mime/index.cjs';
4
+ import { ImageService } from '../image/index.cjs';
5
+ import '../mime/index.cjs';
5
6
  import '../url/index.cjs';
6
7
  import '../utils/index.cjs';
7
8
  import 'stream';
8
9
  import 'buffer';
9
10
 
10
- declare class Fs extends MimeService {
11
+ declare class Fs extends ImageService {
11
12
  cwd: string;
12
13
  constructor(cwd: string);
14
+ getImageSpecs(filePath: string): Promise<{
15
+ width: number;
16
+ height: number;
17
+ format: "png";
18
+ frames: number;
19
+ animated: boolean;
20
+ hasAlpha: boolean;
21
+ orientation: null;
22
+ aspectRatio: number;
23
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
24
+ iccProfile: string | null;
25
+ exifDateTimeOriginal: string | null;
26
+ } | {
27
+ width: number;
28
+ height: number;
29
+ format: "jpeg";
30
+ frames: number;
31
+ animated: false;
32
+ hasAlpha: false;
33
+ orientation: number | null;
34
+ aspectRatio: number;
35
+ colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
36
+ iccProfile: string | null;
37
+ exifDateTimeOriginal: string | null;
38
+ } | {
39
+ width: number;
40
+ height: number;
41
+ format: "gif";
42
+ frames: number;
43
+ animated: boolean;
44
+ hasAlpha: null;
45
+ orientation: null;
46
+ aspectRatio: number;
47
+ colorSpace: "indexed";
48
+ iccProfile: null;
49
+ exifDateTimeOriginal: null;
50
+ } | {
51
+ width: number;
52
+ height: number;
53
+ format: "bmp";
54
+ frames: number;
55
+ animated: false;
56
+ hasAlpha: null;
57
+ orientation: number;
58
+ aspectRatio: number;
59
+ colorSpace: "rgb" | "indexed";
60
+ iccProfile: null;
61
+ exifDateTimeOriginal: null;
62
+ } | {
63
+ width: number;
64
+ height: number;
65
+ format: "webp";
66
+ frames: number;
67
+ animated: boolean;
68
+ hasAlpha: boolean;
69
+ orientation: null;
70
+ aspectRatio: number;
71
+ colorSpace: "unknown" | "rgb" | "rgba";
72
+ iccProfile: string | null;
73
+ exifDateTimeOriginal: null;
74
+ } | {
75
+ width: number;
76
+ height: number;
77
+ format: "avif";
78
+ frames: number;
79
+ animated: boolean;
80
+ hasAlpha: true | null;
81
+ orientation: null;
82
+ aspectRatio: number;
83
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
84
+ iccProfile: string | null;
85
+ exifDateTimeOriginal: string | null;
86
+ }>;
87
+ getImageSpecsTmp(target: string): Promise<{
88
+ width: number;
89
+ height: number;
90
+ format: "png";
91
+ frames: number;
92
+ animated: boolean;
93
+ hasAlpha: boolean;
94
+ orientation: null;
95
+ aspectRatio: number;
96
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
97
+ iccProfile: string | null;
98
+ exifDateTimeOriginal: string | null;
99
+ } | {
100
+ width: number;
101
+ height: number;
102
+ format: "jpeg";
103
+ frames: number;
104
+ animated: false;
105
+ hasAlpha: false;
106
+ orientation: number | null;
107
+ aspectRatio: number;
108
+ colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
109
+ iccProfile: string | null;
110
+ exifDateTimeOriginal: string | null;
111
+ } | {
112
+ width: number;
113
+ height: number;
114
+ format: "gif";
115
+ frames: number;
116
+ animated: boolean;
117
+ hasAlpha: null;
118
+ orientation: null;
119
+ aspectRatio: number;
120
+ colorSpace: "indexed";
121
+ iccProfile: null;
122
+ exifDateTimeOriginal: null;
123
+ } | {
124
+ width: number;
125
+ height: number;
126
+ format: "bmp";
127
+ frames: number;
128
+ animated: false;
129
+ hasAlpha: null;
130
+ orientation: number;
131
+ aspectRatio: number;
132
+ colorSpace: "rgb" | "indexed";
133
+ iccProfile: null;
134
+ exifDateTimeOriginal: null;
135
+ } | {
136
+ width: number;
137
+ height: number;
138
+ format: "webp";
139
+ frames: number;
140
+ animated: boolean;
141
+ hasAlpha: boolean;
142
+ orientation: null;
143
+ aspectRatio: number;
144
+ colorSpace: "unknown" | "rgb" | "rgba";
145
+ iccProfile: string | null;
146
+ exifDateTimeOriginal: null;
147
+ } | {
148
+ width: number;
149
+ height: number;
150
+ format: "avif";
151
+ frames: number;
152
+ animated: boolean;
153
+ hasAlpha: true | null;
154
+ orientation: null;
155
+ aspectRatio: number;
156
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
157
+ iccProfile: string | null;
158
+ exifDateTimeOriginal: string | null;
159
+ }>;
13
160
  private get myEnv();
14
161
  get tmpDir(): string;
15
162
  get tmpDirRelative(): string;
@@ -113,12 +260,12 @@ declare class Fs extends MimeService {
113
260
  fileToBufferAsync: <const T extends string>(path: T) => Promise<Buffer<ArrayBufferLike>>;
114
261
  dirContainsDir<const From extends string, const To extends string>(readDir: From, targetDir: To, options?: ReadDirOptions): boolean;
115
262
  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: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: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:video/mpeg;base64, ${string}` | `data:application/vnd.apple.installer+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:video/webm;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:application/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}`;
117
- readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "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" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "ts" | "rs" | "py" | "txt" | "html" | "htm" | "cjs" | "mjs" | "md" | "vtt" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "weba" | "avi";
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";
118
265
  }>;
119
266
  assetToBufferView<const T extends string>(path: T): Promise<{
120
267
  readonly b64encodedData: string;
121
- readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "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" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "ts" | "rs" | "py" | "txt" | "html" | "htm" | "cjs" | "mjs" | "md" | "vtt" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "weba" | "avi" | undefined;
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;
122
269
  }>;
123
270
  formatHelper<const T extends string>(f: T): string;
124
271
  cleanDataUrl<const C extends string>(props: C): string;
@@ -135,10 +282,7 @@ declare class Fs extends MimeService {
135
282
  * ✅ 'public/assets/image-1.png'
136
283
  */
137
284
  fetchRemoteWriteLocal<const I extends string, const O extends string>(inputUrl: I, outputPath: O, useDetectedExtension?: boolean): Promise<void>;
138
- parseExif(buffer: Buffer, app1Pos: number, _app1Size: number): {
139
- orientation: number | null;
140
- dateTimeOriginal: string | null;
141
- };
285
+ private knownToBlockHead;
142
286
  /**
143
287
  *
144
288
  * @param inputUrl remote url to fetch data from
@@ -152,84 +296,11 @@ declare class Fs extends MimeService {
152
296
  * ✅ 'public/assets/image-1.png'
153
297
  *
154
298
  * @description
155
- * This method is designed for large files that may not fit into memory.
156
- * It streams the data directly to disk instead of loading it all into memory.
299
+ * This method is designed for all files regardless of size, but especially for
300
+ * larger files that may not fit into memory (it intelligently determines the best approach on the fly)
301
+ * For files > 100 MB, it streams the data directly to disk instead of loading it all into memory
157
302
  */
158
303
  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
304
  /**
234
305
  *
235
306
  * @access package-private
@@ -267,6 +338,7 @@ declare class Fs extends MimeService {
267
338
  * ```
268
339
  */
269
340
  writeTmp<const F extends string>(filename: F, data: WriteStreamDataShape, options?: WriteStreamOptions): void;
341
+ readTmpAsync<const F extends string>(filename: F): Promise<Buffer<ArrayBufferLike>>;
270
342
  /**
271
343
  * Read a file from the tmp directory
272
344
  * @param filename The filename to read (can include subdirectories)
@@ -1,15 +1,162 @@
1
1
  import expand from 'dotenv-expand';
2
2
  import sharp from 'sharp';
3
3
  import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, Unit, SizeOpts, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.js';
4
- import { MimeService } from '../mime/index.js';
4
+ import { ImageService } from '../image/index.js';
5
+ import '../mime/index.js';
5
6
  import '../url/index.js';
6
7
  import '../utils/index.js';
7
8
  import 'stream';
8
9
  import 'buffer';
9
10
 
10
- declare class Fs extends MimeService {
11
+ declare class Fs extends ImageService {
11
12
  cwd: string;
12
13
  constructor(cwd: string);
14
+ getImageSpecs(filePath: string): Promise<{
15
+ width: number;
16
+ height: number;
17
+ format: "png";
18
+ frames: number;
19
+ animated: boolean;
20
+ hasAlpha: boolean;
21
+ orientation: null;
22
+ aspectRatio: number;
23
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
24
+ iccProfile: string | null;
25
+ exifDateTimeOriginal: string | null;
26
+ } | {
27
+ width: number;
28
+ height: number;
29
+ format: "jpeg";
30
+ frames: number;
31
+ animated: false;
32
+ hasAlpha: false;
33
+ orientation: number | null;
34
+ aspectRatio: number;
35
+ colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
36
+ iccProfile: string | null;
37
+ exifDateTimeOriginal: string | null;
38
+ } | {
39
+ width: number;
40
+ height: number;
41
+ format: "gif";
42
+ frames: number;
43
+ animated: boolean;
44
+ hasAlpha: null;
45
+ orientation: null;
46
+ aspectRatio: number;
47
+ colorSpace: "indexed";
48
+ iccProfile: null;
49
+ exifDateTimeOriginal: null;
50
+ } | {
51
+ width: number;
52
+ height: number;
53
+ format: "bmp";
54
+ frames: number;
55
+ animated: false;
56
+ hasAlpha: null;
57
+ orientation: number;
58
+ aspectRatio: number;
59
+ colorSpace: "rgb" | "indexed";
60
+ iccProfile: null;
61
+ exifDateTimeOriginal: null;
62
+ } | {
63
+ width: number;
64
+ height: number;
65
+ format: "webp";
66
+ frames: number;
67
+ animated: boolean;
68
+ hasAlpha: boolean;
69
+ orientation: null;
70
+ aspectRatio: number;
71
+ colorSpace: "unknown" | "rgb" | "rgba";
72
+ iccProfile: string | null;
73
+ exifDateTimeOriginal: null;
74
+ } | {
75
+ width: number;
76
+ height: number;
77
+ format: "avif";
78
+ frames: number;
79
+ animated: boolean;
80
+ hasAlpha: true | null;
81
+ orientation: null;
82
+ aspectRatio: number;
83
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
84
+ iccProfile: string | null;
85
+ exifDateTimeOriginal: string | null;
86
+ }>;
87
+ getImageSpecsTmp(target: string): Promise<{
88
+ width: number;
89
+ height: number;
90
+ format: "png";
91
+ frames: number;
92
+ animated: boolean;
93
+ hasAlpha: boolean;
94
+ orientation: null;
95
+ aspectRatio: number;
96
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
97
+ iccProfile: string | null;
98
+ exifDateTimeOriginal: string | null;
99
+ } | {
100
+ width: number;
101
+ height: number;
102
+ format: "jpeg";
103
+ frames: number;
104
+ animated: false;
105
+ hasAlpha: false;
106
+ orientation: number | null;
107
+ aspectRatio: number;
108
+ colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
109
+ iccProfile: string | null;
110
+ exifDateTimeOriginal: string | null;
111
+ } | {
112
+ width: number;
113
+ height: number;
114
+ format: "gif";
115
+ frames: number;
116
+ animated: boolean;
117
+ hasAlpha: null;
118
+ orientation: null;
119
+ aspectRatio: number;
120
+ colorSpace: "indexed";
121
+ iccProfile: null;
122
+ exifDateTimeOriginal: null;
123
+ } | {
124
+ width: number;
125
+ height: number;
126
+ format: "bmp";
127
+ frames: number;
128
+ animated: false;
129
+ hasAlpha: null;
130
+ orientation: number;
131
+ aspectRatio: number;
132
+ colorSpace: "rgb" | "indexed";
133
+ iccProfile: null;
134
+ exifDateTimeOriginal: null;
135
+ } | {
136
+ width: number;
137
+ height: number;
138
+ format: "webp";
139
+ frames: number;
140
+ animated: boolean;
141
+ hasAlpha: boolean;
142
+ orientation: null;
143
+ aspectRatio: number;
144
+ colorSpace: "unknown" | "rgb" | "rgba";
145
+ iccProfile: string | null;
146
+ exifDateTimeOriginal: null;
147
+ } | {
148
+ width: number;
149
+ height: number;
150
+ format: "avif";
151
+ frames: number;
152
+ animated: boolean;
153
+ hasAlpha: true | null;
154
+ orientation: null;
155
+ aspectRatio: number;
156
+ colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
157
+ iccProfile: string | null;
158
+ exifDateTimeOriginal: string | null;
159
+ }>;
13
160
  private get myEnv();
14
161
  get tmpDir(): string;
15
162
  get tmpDirRelative(): string;
@@ -113,12 +260,12 @@ declare class Fs extends MimeService {
113
260
  fileToBufferAsync: <const T extends string>(path: T) => Promise<Buffer<ArrayBufferLike>>;
114
261
  dirContainsDir<const From extends string, const To extends string>(readDir: From, targetDir: To, options?: ReadDirOptions): boolean;
115
262
  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: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: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:video/mpeg;base64, ${string}` | `data:application/vnd.apple.installer+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:video/webm;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:application/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}`;
117
- readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "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" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "ts" | "rs" | "py" | "txt" | "html" | "htm" | "cjs" | "mjs" | "md" | "vtt" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "weba" | "avi";
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";
118
265
  }>;
119
266
  assetToBufferView<const T extends string>(path: T): Promise<{
120
267
  readonly b64encodedData: string;
121
- readonly extension: "png" | "jpeg" | "gif" | "bmp" | "webp" | "avif" | "epub" | "ttf" | "gz" | "jar" | "json" | "jsonld" | "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" | "yaml" | "aac" | "mid" | "m4a" | "mp3" | "opus" | "ogg" | "oga" | "wav" | "midi" | "otf" | "woff" | "woff2" | "hjif" | "hmpg" | "ivs" | "ivt" | "aces" | "apng" | "avci" | "dpx" | "emf" | "jpg" | "ktx" | "ktx2" | "svg" | "tiff" | "tif" | "ico" | "glb" | "gltf" | "usdz" | "ics" | "css" | "csv" | "sse" | "ts" | "rs" | "py" | "txt" | "html" | "htm" | "cjs" | "mjs" | "md" | "vtt" | "3gp" | "3g2" | "mp4" | "m4v" | "mpeg" | "ogv" | "weba" | "avi" | undefined;
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;
122
269
  }>;
123
270
  formatHelper<const T extends string>(f: T): string;
124
271
  cleanDataUrl<const C extends string>(props: C): string;
@@ -135,10 +282,7 @@ declare class Fs extends MimeService {
135
282
  * ✅ 'public/assets/image-1.png'
136
283
  */
137
284
  fetchRemoteWriteLocal<const I extends string, const O extends string>(inputUrl: I, outputPath: O, useDetectedExtension?: boolean): Promise<void>;
138
- parseExif(buffer: Buffer, app1Pos: number, _app1Size: number): {
139
- orientation: number | null;
140
- dateTimeOriginal: string | null;
141
- };
285
+ private knownToBlockHead;
142
286
  /**
143
287
  *
144
288
  * @param inputUrl remote url to fetch data from
@@ -152,84 +296,11 @@ declare class Fs extends MimeService {
152
296
  * ✅ 'public/assets/image-1.png'
153
297
  *
154
298
  * @description
155
- * This method is designed for large files that may not fit into memory.
156
- * It streams the data directly to disk instead of loading it all into memory.
299
+ * This method is designed for all files regardless of size, but especially for
300
+ * larger files that may not fit into memory (it intelligently determines the best approach on the fly)
301
+ * For files > 100 MB, it streams the data directly to disk instead of loading it all into memory
157
302
  */
158
303
  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
304
  /**
234
305
  *
235
306
  * @access package-private
@@ -267,6 +338,7 @@ declare class Fs extends MimeService {
267
338
  * ```
268
339
  */
269
340
  writeTmp<const F extends string>(filename: F, data: WriteStreamDataShape, options?: WriteStreamOptions): void;
341
+ readTmpAsync<const F extends string>(filename: F): Promise<Buffer<ArrayBufferLike>>;
270
342
  /**
271
343
  * Read a file from the tmp directory
272
344
  * @param filename The filename to read (can include subdirectories)
package/dist/fs/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  Fs
3
- } from "../chunk-CTA73JRX.js";
4
- import "../chunk-CN45SMBB.js";
5
- import "../chunk-G27YIWW7.js";
3
+ } from "../chunk-3REIEDSC.js";
4
+ import "../chunk-LFHV4PPA.js";
5
+ import "../chunk-3WB2TSBO.js";
6
+ import "../chunk-RJ2YQE3C.js";
6
7
  import "../chunk-QBG7TFHM.js";
7
8
  import "../chunk-IUGBPDQJ.js";
8
9
  import "../chunk-7QVYU63E.js";