@d0paminedriven/fs 7.3.0 → 7.4.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 CHANGED
@@ -132,18 +132,41 @@ This implementation comes from a non-traditional developer with degrees in Bioch
132
132
  // Memory savings: 99.993%!
133
133
  ```
134
134
 
135
+ #### 🏆 Production Benchmark: PBR Texture Pipeline
136
+
137
+ **Real-world test with 99 professional PBR textures:**
138
+
139
+ ```ts
140
+ // Test setup: 99 PBR texture files
141
+ // - 75 JPEGs @ 4096×4096 (professional game/3D assets)
142
+ // - 24 PNGs @ 2048×2048 (normal maps, height maps, etc.)
143
+ // - Mix of diffuse, normal, roughness, metalness, AO maps
144
+
145
+ // Method used: getImageSpecs() with 24KB buffer
146
+ await fs.getImageSpecs(texturePath, 4096 * 6);
147
+
148
+ // Results:
149
+ Duration: 48.96ms for all 99 files
150
+ Average: 0.494ms per file
151
+ Throughput: 2,024 files/second
152
+
153
+ // Theoretical capacity:
154
+ // - 120,000+ textures per minute
155
+ // - Process entire AAA game asset library in seconds
156
+ ```
157
+
135
158
  #### Comprehensive Metadata Extraction
136
159
 
137
160
  ```typescript
138
161
  // Choose your weapon: Buffer or Stream
139
162
 
140
- // Stream-based (recommended for production):
141
- const metadata = await fs.getImageSpecsStream("massive-image.png");
163
+ // Stream-based with a configurable header size (recommended for production):
164
+ const metadata = await fs.getImageSpecsStream("massive-image.png", 4096);
142
165
  // ⚡ Sub-millisecond for any size file
143
166
 
144
- // Buffer-based (when you need the full buffer anyway):
145
- const metadata = await fs.getImageSpecs("image.png");
146
- // 🔥 Still blazing fast
167
+ // Buffer-based with configurable header size:
168
+ const metadata = await fs.getImageSpecs("texture.jpg", 4096 * 6);
169
+ // 🔥 Handles professional assets with extensive metadata
147
170
 
148
171
  // Returns rich metadata:
149
172
  {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ImageService
3
- } from "./chunk-2XQ44ZWR.js";
3
+ } from "./chunk-C2ANVZLG.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -62,6 +62,8 @@ var FsBase = class extends ImageService {
62
62
  return true;
63
63
  } else if (path.includes(this.homeDir)) {
64
64
  return true;
65
+ } else {
66
+ return false;
65
67
  }
66
68
  }
67
69
  isRootPathTargeted(path) {
@@ -104,6 +106,7 @@ var FsBase = class extends ImageService {
104
106
  return Readable.from([data]);
105
107
  if (this.isWebReadableStream(data)) return Readable.fromWeb(data);
106
108
  if (this.isAsyncIterable(data)) return Readable.from(data);
109
+ if (data instanceof Readable) return data;
107
110
  throw new TypeError("Unsupported data type for toReadable()");
108
111
  }
109
112
  /**
@@ -234,4 +237,4 @@ var FsBase = class extends ImageService {
234
237
  export {
235
238
  FsBase
236
239
  };
237
- //# sourceMappingURL=chunk-LQP2FYMK.js.map
240
+ //# sourceMappingURL=chunk-7FHBNIB7.js.map
@@ -56,8 +56,8 @@ var ImageService = class extends MimeService {
56
56
  * Extract image metadata from a stream, reading only ~4KB for most formats
57
57
  * Automatically handles PNG, JPEG, GIF, BMP, WebP, and AVIF
58
58
  */
59
- async extractFromStream(stream) {
60
- const headerSize = 4096;
59
+ async extractFromStream(stream, size = 4096) {
60
+ const headerSize = size;
61
61
  const header = await this.readBytes(stream, headerSize);
62
62
  if (this.isPNG(header)) {
63
63
  return this.extractPNGFromBuffer(header);
@@ -82,9 +82,9 @@ var ImageService = class extends MimeService {
82
82
  /**
83
83
  * Extract metadata from file path using streaming (memory efficient)
84
84
  */
85
- async extractFromPath(filePath) {
86
- const stream = createReadStream(relative(this.cwd, filePath), { highWaterMark: 4096 });
87
- return this.extractFromStream(stream);
85
+ async extractFromPath(filePath, size = 4096) {
86
+ const stream = createReadStream(relative(this.cwd, filePath), { highWaterMark: size });
87
+ return this.extractFromStream(stream, size);
88
88
  }
89
89
  // Format detection helpers
90
90
  isPNG(buffer) {
@@ -523,7 +523,9 @@ var ImageService = class extends MimeService {
523
523
  * Legacy method that processes entire buffer
524
524
  * Use extractFromStream or extractFromPath for better memory efficiency
525
525
  */
526
- getImageSpecsWorkup(buffer) {
526
+ getImageSpecsWorkup(rawbuffer, size = 8192) {
527
+ const MAX_HEADER_SIZE = size;
528
+ const buffer = rawbuffer.subarray(0, Math.min(rawbuffer.length, MAX_HEADER_SIZE));
527
529
  if (buffer?.length >= 24 && buffer?.[0] === 137 && buffer?.[1] === 80 && buffer?.[2] === 78 && buffer?.[3] === 71 && buffer?.[4] === 13 && buffer?.[5] === 10 && buffer?.[6] === 26 && buffer?.[7] === 10) {
528
530
  if (buffer.readUint32BE(8) !== 13 || buffer?.[12] !== 73 || buffer?.[13] !== 72 || buffer?.[14] !== 68 || buffer?.[15] !== 82) {
529
531
  throw new Error("IHDR Chunk of png not found or incorrect.");
@@ -642,6 +644,9 @@ var ImageService = class extends MimeService {
642
644
  }
643
645
  }
644
646
  pos += segmentSize + 2;
647
+ while (pos < buffer.length - 1 && buffer[pos] === 0) {
648
+ pos++;
649
+ }
645
650
  }
646
651
  if (width === 0) throw new Error("No dimensions found in JPEG file");
647
652
  return {
@@ -910,4 +915,4 @@ var ImageService = class extends MimeService {
910
915
  export {
911
916
  ImageService
912
917
  };
913
- //# sourceMappingURL=chunk-2XQ44ZWR.js.map
918
+ //# sourceMappingURL=chunk-C2ANVZLG.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-R63XI7FS.js";
4
4
  import {
5
5
  FsAtomic
6
- } from "./chunk-NHYRCNMW.js";
6
+ } from "./chunk-XCA34DKZ.js";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-7QVYU63E.js";
@@ -72,4 +72,4 @@ var FsSize = class extends FsAtomic {
72
72
  export {
73
73
  FsSize
74
74
  };
75
- //# sourceMappingURL=chunk-2IRCHZCF.js.map
75
+ //# sourceMappingURL=chunk-FPB77OGJ.js.map
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  FsFetch
3
- } from "./chunk-NOOFSAF4.js";
3
+ } from "./chunk-Q2VF3BVH.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
7
7
 
8
8
  // src/fs/index.ts
9
- import { resolve } from "path";
9
+ import { createReadStream } from "fs";
10
+ import { relative, resolve } from "path";
10
11
  import sharp from "sharp";
11
12
  var Fs = class extends FsFetch {
12
13
  constructor(cwd) {
@@ -17,20 +18,25 @@ var Fs = class extends FsFetch {
17
18
  static {
18
19
  __name(this, "Fs");
19
20
  }
20
- async getImageSpecs(filePath) {
21
- const buffer = await this.fileToBufferAsync(filePath);
22
- return this.getImageSpecsWorkup(buffer);
21
+ async getImageSpecs(filePath, size = 4096 * 6) {
22
+ const stream = createReadStream(relative(this.cwd, filePath), {
23
+ highWaterMark: size
24
+ });
25
+ return this.extractFromStream(stream, size);
23
26
  }
24
- async getImageSpecsTmp(target) {
25
- const buffer = await this.readTmpAsync(target);
26
- return this.getImageSpecsWorkup(buffer);
27
+ async getImageSpecsTmp(filepath, size = 4096 * 6) {
28
+ const stream = createReadStream(
29
+ relative(this.cwd, resolve(this.tmpDir, filepath)),
30
+ { highWaterMark: size }
31
+ );
32
+ return this.extractFromStream(stream);
27
33
  }
28
34
  /**
29
35
  * Extract image metadata using streaming (only reads ~4KB)
30
36
  * Much more memory efficient for large images
31
37
  */
32
- async getImageSpecsStream(filePath) {
33
- return this.extractFromPath(filePath);
38
+ async getImageSpecsStream(filePath, size = 4096) {
39
+ return this.extractFromPath(filePath, size);
34
40
  }
35
41
  async getImageSpecsStreamTmp(filePath) {
36
42
  return this.extractFromPath(resolve(this.tmpDir, filePath));
@@ -66,4 +72,4 @@ var Fs = class extends FsFetch {
66
72
  export {
67
73
  Fs
68
74
  };
69
- //# sourceMappingURL=chunk-HPM4IQQR.js.map
75
+ //# sourceMappingURL=chunk-IU4MDHYM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FsSize
3
- } from "./chunk-2IRCHZCF.js";
3
+ } from "./chunk-FPB77OGJ.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -66,4 +66,4 @@ var FsCore = class extends FsSize {
66
66
  export {
67
67
  FsCore
68
68
  };
69
- //# sourceMappingURL=chunk-KOKPGEU4.js.map
69
+ //# sourceMappingURL=chunk-KDWGS5GC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FsTmp
3
- } from "./chunk-PTXZQBLV.js";
3
+ } from "./chunk-TDMPLELZ.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -136,7 +136,7 @@ var FsFetch = class extends FsTmp {
136
136
  throw new Error(`Failed to fetch asset: ${res.statusText}`);
137
137
  }
138
138
  const writeStream = fsSync.createWriteStream(
139
- relative(this.cwd ?? process.cwd(), formattedPath)
139
+ relative(this.cwd, formattedPath)
140
140
  );
141
141
  const reader = res.body.getReader();
142
142
  const pump = /* @__PURE__ */ __name(async () => {
@@ -162,4 +162,4 @@ var FsFetch = class extends FsTmp {
162
162
  export {
163
163
  FsFetch
164
164
  };
165
- //# sourceMappingURL=chunk-NOOFSAF4.js.map
165
+ //# sourceMappingURL=chunk-Q2VF3BVH.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FsCore
3
- } from "./chunk-KOKPGEU4.js";
3
+ } from "./chunk-KDWGS5GC.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -364,4 +364,4 @@ var FsTmp = class extends FsCore {
364
364
  export {
365
365
  FsTmp
366
366
  };
367
- //# sourceMappingURL=chunk-PTXZQBLV.js.map
367
+ //# sourceMappingURL=chunk-TDMPLELZ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FsBase
3
- } from "./chunk-LQP2FYMK.js";
3
+ } from "./chunk-7FHBNIB7.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-7QVYU63E.js";
@@ -104,4 +104,4 @@ var FsAtomic = class extends FsBase {
104
104
  export {
105
105
  FsAtomic
106
106
  };
107
- //# sourceMappingURL=chunk-NHYRCNMW.js.map
107
+ //# sourceMappingURL=chunk-XCA34DKZ.js.map
@@ -21,157 +21,13 @@ import 'dotenv-expand';
21
21
  declare class Fs extends FsFetch {
22
22
  cwd: string;
23
23
  constructor(cwd: string);
24
- getImageSpecs(filePath: string): Promise<{
25
- width: number;
26
- height: number;
27
- format: "png";
28
- frames: number;
29
- animated: boolean;
30
- hasAlpha: boolean;
31
- orientation: null;
32
- aspectRatio: number;
33
- colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
34
- iccProfile: string | null;
35
- exifDateTimeOriginal: string | null;
36
- } | {
37
- width: number;
38
- height: number;
39
- format: "jpeg";
40
- frames: number;
41
- animated: false;
42
- hasAlpha: false;
43
- orientation: number | null;
44
- aspectRatio: number;
45
- colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
46
- iccProfile: string | null;
47
- exifDateTimeOriginal: string | null;
48
- } | {
49
- width: number;
50
- height: number;
51
- format: "gif";
52
- frames: number;
53
- animated: boolean;
54
- hasAlpha: null;
55
- orientation: null;
56
- aspectRatio: number;
57
- colorSpace: "indexed";
58
- iccProfile: null;
59
- exifDateTimeOriginal: null;
60
- } | {
61
- width: number;
62
- height: number;
63
- format: "bmp";
64
- frames: number;
65
- animated: false;
66
- hasAlpha: null;
67
- orientation: number;
68
- aspectRatio: number;
69
- colorSpace: "rgb" | "indexed";
70
- iccProfile: null;
71
- exifDateTimeOriginal: null;
72
- } | {
73
- width: number;
74
- height: number;
75
- format: "webp";
76
- frames: number;
77
- animated: boolean;
78
- hasAlpha: boolean;
79
- orientation: null;
80
- aspectRatio: number;
81
- colorSpace: "unknown" | "rgb" | "rgba";
82
- iccProfile: string | null;
83
- exifDateTimeOriginal: null;
84
- } | {
85
- width: number;
86
- height: number;
87
- format: "avif";
88
- frames: number;
89
- animated: boolean;
90
- hasAlpha: true | null;
91
- orientation: null;
92
- aspectRatio: number;
93
- colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
94
- iccProfile: string | null;
95
- exifDateTimeOriginal: string | null;
96
- }>;
97
- getImageSpecsTmp(target: string): Promise<{
98
- width: number;
99
- height: number;
100
- format: "png";
101
- frames: number;
102
- animated: boolean;
103
- hasAlpha: boolean;
104
- orientation: null;
105
- aspectRatio: number;
106
- colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed";
107
- iccProfile: string | null;
108
- exifDateTimeOriginal: string | null;
109
- } | {
110
- width: number;
111
- height: number;
112
- format: "jpeg";
113
- frames: number;
114
- animated: false;
115
- hasAlpha: false;
116
- orientation: number | null;
117
- aspectRatio: number;
118
- colorSpace: "unknown" | "grayscale" | "ycbcr" | "ycck";
119
- iccProfile: string | null;
120
- exifDateTimeOriginal: string | null;
121
- } | {
122
- width: number;
123
- height: number;
124
- format: "gif";
125
- frames: number;
126
- animated: boolean;
127
- hasAlpha: null;
128
- orientation: null;
129
- aspectRatio: number;
130
- colorSpace: "indexed";
131
- iccProfile: null;
132
- exifDateTimeOriginal: null;
133
- } | {
134
- width: number;
135
- height: number;
136
- format: "bmp";
137
- frames: number;
138
- animated: false;
139
- hasAlpha: null;
140
- orientation: number;
141
- aspectRatio: number;
142
- colorSpace: "rgb" | "indexed";
143
- iccProfile: null;
144
- exifDateTimeOriginal: null;
145
- } | {
146
- width: number;
147
- height: number;
148
- format: "webp";
149
- frames: number;
150
- animated: boolean;
151
- hasAlpha: boolean;
152
- orientation: null;
153
- aspectRatio: number;
154
- colorSpace: "unknown" | "rgb" | "rgba";
155
- iccProfile: string | null;
156
- exifDateTimeOriginal: null;
157
- } | {
158
- width: number;
159
- height: number;
160
- format: "avif";
161
- frames: number;
162
- animated: boolean;
163
- hasAlpha: true | null;
164
- orientation: null;
165
- aspectRatio: number;
166
- colorSpace: "unknown" | "rgb" | "rgba" | "grayscale" | "grayscale-alpha" | "indexed" | "cmyk" | "ycbcr" | "ycck";
167
- iccProfile: string | null;
168
- exifDateTimeOriginal: string | null;
169
- }>;
24
+ getImageSpecs(filePath: string, size?: number): Promise<ImageSpecs>;
25
+ getImageSpecsTmp(filepath: string, size?: number): Promise<ImageSpecs>;
170
26
  /**
171
27
  * Extract image metadata using streaming (only reads ~4KB)
172
28
  * Much more memory efficient for large images
173
29
  */
174
- getImageSpecsStream(filePath: string): Promise<ImageSpecs>;
30
+ getImageSpecsStream(filePath: string, size?: number): Promise<ImageSpecs>;
175
31
  getImageSpecsStreamTmp(filePath: string): Promise<ImageSpecs>;
176
32
  /**
177
33
  *
@@ -179,7 +35,7 @@ declare class Fs extends FsFetch {
179
35
  *
180
36
  * work in progress, for internal package maintainer use only
181
37
  */
182
- imageTransform<const F extends "webp" | "avif" | "jpg" | "png" | "tif" | "tiff" | "jp2" | "jpeg">({ format, target, quality, tint, resize }: {
38
+ imageTransform<const F extends "webp" | "avif" | "jpg" | "gif" | "svg" | "png" | "tif" | "tiff" | "jp2" | "jpeg">({ format, target, quality, tint, resize }: {
183
39
  format: F;
184
40
  target: Buffer<ArrayBuffer>;
185
41
  quality?: number;
package/dist/fs/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  Fs
3
- } from "../chunk-HPM4IQQR.js";
4
- import "../chunk-NOOFSAF4.js";
5
- import "../chunk-PTXZQBLV.js";
6
- import "../chunk-KOKPGEU4.js";
7
- import "../chunk-2IRCHZCF.js";
3
+ } from "../chunk-IU4MDHYM.js";
4
+ import "../chunk-Q2VF3BVH.js";
5
+ import "../chunk-TDMPLELZ.js";
6
+ import "../chunk-KDWGS5GC.js";
7
+ import "../chunk-FPB77OGJ.js";
8
8
  import "../chunk-R63XI7FS.js";
9
- import "../chunk-NHYRCNMW.js";
10
- import "../chunk-LQP2FYMK.js";
11
- import "../chunk-2XQ44ZWR.js";
9
+ import "../chunk-XCA34DKZ.js";
10
+ import "../chunk-7FHBNIB7.js";
11
+ import "../chunk-C2ANVZLG.js";
12
12
  import "../chunk-KNLXF622.js";
13
13
  import "../chunk-UW52DMHT.js";
14
14
  import "../chunk-6HHKXBIM.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  FsAtomic
3
- } from "../chunk-NHYRCNMW.js";
4
- import "../chunk-LQP2FYMK.js";
5
- import "../chunk-2XQ44ZWR.js";
3
+ } from "../chunk-XCA34DKZ.js";
4
+ import "../chunk-7FHBNIB7.js";
5
+ import "../chunk-C2ANVZLG.js";
6
6
  import "../chunk-KNLXF622.js";
7
7
  import "../chunk-UW52DMHT.js";
8
8
  import "../chunk-6HHKXBIM.js";
@@ -23,7 +23,7 @@ declare class FsBase extends ImageService {
23
23
  private get env();
24
24
  parseDotEnv(): expand.DotenvParseOutput | undefined;
25
25
  relative(from: string, to: string): string;
26
- isHomeTargeted(path: string): true | undefined;
26
+ isHomeTargeted(path: string): boolean;
27
27
  isRootPathTargeted<const T extends string>(path: T): boolean;
28
28
  pathHandler<const T extends string>(path: T): string;
29
29
  isUint8Array(v: unknown): v is Uint8Array<ArrayBufferLike>;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FsBase
3
- } from "../chunk-LQP2FYMK.js";
4
- import "../chunk-2XQ44ZWR.js";
3
+ } from "../chunk-7FHBNIB7.js";
4
+ import "../chunk-C2ANVZLG.js";
5
5
  import "../chunk-KNLXF622.js";
6
6
  import "../chunk-UW52DMHT.js";
7
7
  import "../chunk-6HHKXBIM.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  FsCore
3
- } from "../chunk-KOKPGEU4.js";
4
- import "../chunk-2IRCHZCF.js";
3
+ } from "../chunk-KDWGS5GC.js";
4
+ import "../chunk-FPB77OGJ.js";
5
5
  import "../chunk-R63XI7FS.js";
6
- import "../chunk-NHYRCNMW.js";
7
- import "../chunk-LQP2FYMK.js";
8
- import "../chunk-2XQ44ZWR.js";
6
+ import "../chunk-XCA34DKZ.js";
7
+ import "../chunk-7FHBNIB7.js";
8
+ import "../chunk-C2ANVZLG.js";
9
9
  import "../chunk-KNLXF622.js";
10
10
  import "../chunk-UW52DMHT.js";
11
11
  import "../chunk-6HHKXBIM.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  FsFetch
3
- } from "../chunk-NOOFSAF4.js";
4
- import "../chunk-PTXZQBLV.js";
5
- import "../chunk-KOKPGEU4.js";
6
- import "../chunk-2IRCHZCF.js";
3
+ } from "../chunk-Q2VF3BVH.js";
4
+ import "../chunk-TDMPLELZ.js";
5
+ import "../chunk-KDWGS5GC.js";
6
+ import "../chunk-FPB77OGJ.js";
7
7
  import "../chunk-R63XI7FS.js";
8
- import "../chunk-NHYRCNMW.js";
9
- import "../chunk-LQP2FYMK.js";
10
- import "../chunk-2XQ44ZWR.js";
8
+ import "../chunk-XCA34DKZ.js";
9
+ import "../chunk-7FHBNIB7.js";
10
+ import "../chunk-C2ANVZLG.js";
11
11
  import "../chunk-KNLXF622.js";
12
12
  import "../chunk-UW52DMHT.js";
13
13
  import "../chunk-6HHKXBIM.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  FsSize
3
- } from "../chunk-2IRCHZCF.js";
3
+ } from "../chunk-FPB77OGJ.js";
4
4
  import "../chunk-R63XI7FS.js";
5
- import "../chunk-NHYRCNMW.js";
6
- import "../chunk-LQP2FYMK.js";
7
- import "../chunk-2XQ44ZWR.js";
5
+ import "../chunk-XCA34DKZ.js";
6
+ import "../chunk-7FHBNIB7.js";
7
+ import "../chunk-C2ANVZLG.js";
8
8
  import "../chunk-KNLXF622.js";
9
9
  import "../chunk-UW52DMHT.js";
10
10
  import "../chunk-6HHKXBIM.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  FsTmp
3
- } from "../chunk-PTXZQBLV.js";
4
- import "../chunk-KOKPGEU4.js";
5
- import "../chunk-2IRCHZCF.js";
3
+ } from "../chunk-TDMPLELZ.js";
4
+ import "../chunk-KDWGS5GC.js";
5
+ import "../chunk-FPB77OGJ.js";
6
6
  import "../chunk-R63XI7FS.js";
7
- import "../chunk-NHYRCNMW.js";
8
- import "../chunk-LQP2FYMK.js";
9
- import "../chunk-2XQ44ZWR.js";
7
+ import "../chunk-XCA34DKZ.js";
8
+ import "../chunk-7FHBNIB7.js";
9
+ import "../chunk-C2ANVZLG.js";
10
10
  import "../chunk-KNLXF622.js";
11
11
  import "../chunk-UW52DMHT.js";
12
12
  import "../chunk-6HHKXBIM.js";
@@ -19,11 +19,11 @@ declare class ImageService extends MimeService {
19
19
  * Extract image metadata from a stream, reading only ~4KB for most formats
20
20
  * Automatically handles PNG, JPEG, GIF, BMP, WebP, and AVIF
21
21
  */
22
- extractFromStream(stream: Readable): Promise<ImageSpecs>;
22
+ extractFromStream(stream: Readable, size?: number): Promise<ImageSpecs>;
23
23
  /**
24
24
  * Extract metadata from file path using streaming (memory efficient)
25
25
  */
26
- extractFromPath(filePath: string): Promise<ImageSpecs>;
26
+ extractFromPath(filePath: string, size?: number): Promise<ImageSpecs>;
27
27
  private isPNG;
28
28
  private isJPEG;
29
29
  private isGIF;
@@ -44,7 +44,7 @@ declare class ImageService extends MimeService {
44
44
  * Legacy method that processes entire buffer
45
45
  * Use extractFromStream or extractFromPath for better memory efficiency
46
46
  */
47
- getImageSpecsWorkup(buffer: Buffer<ArrayBufferLike>): {
47
+ getImageSpecsWorkup(rawbuffer: Buffer<ArrayBufferLike>, size?: number): {
48
48
  width: number;
49
49
  height: number;
50
50
  format: "png";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ImageService
3
- } from "../chunk-2XQ44ZWR.js";
3
+ } from "../chunk-C2ANVZLG.js";
4
4
  import "../chunk-KNLXF622.js";
5
5
  import "../chunk-UW52DMHT.js";
6
6
  import "../chunk-6HHKXBIM.js";
package/dist/index.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  Fs
3
- } from "./chunk-HPM4IQQR.js";
3
+ } from "./chunk-IU4MDHYM.js";
4
4
  import {
5
5
  FsFetch
6
- } from "./chunk-NOOFSAF4.js";
6
+ } from "./chunk-Q2VF3BVH.js";
7
7
  import {
8
8
  FsTmp
9
- } from "./chunk-PTXZQBLV.js";
9
+ } from "./chunk-TDMPLELZ.js";
10
10
  import {
11
11
  FsCore
12
- } from "./chunk-KOKPGEU4.js";
12
+ } from "./chunk-KDWGS5GC.js";
13
13
  import {
14
14
  FsSize
15
- } from "./chunk-2IRCHZCF.js";
15
+ } from "./chunk-FPB77OGJ.js";
16
16
  import {
17
17
  unitsObj
18
18
  } from "./chunk-R63XI7FS.js";
19
19
  import {
20
20
  FsAtomic
21
- } from "./chunk-NHYRCNMW.js";
21
+ } from "./chunk-XCA34DKZ.js";
22
22
  import {
23
23
  FsBase
24
- } from "./chunk-LQP2FYMK.js";
24
+ } from "./chunk-7FHBNIB7.js";
25
25
  import {
26
26
  ImageService
27
- } from "./chunk-2XQ44ZWR.js";
27
+ } from "./chunk-C2ANVZLG.js";
28
28
  import {
29
29
  MimeService,
30
30
  extMimeMap,
@@ -1,9 +1,10 @@
1
1
  import { ReadableStream } from 'stream/web';
2
+ import { Readable } from 'node:stream';
2
3
 
3
4
  type Bin = Buffer | Uint8Array;
4
5
  type WebRS = ReadableStream<Uint8Array>;
5
6
  type AsyncIter = AsyncIterable<Uint8Array>;
6
7
  /** Inputs you actually accept — no `any`, no lies. */
7
- type Streamable = string | Bin | WebRS | AsyncIter;
8
+ type Streamable = string | Bin | WebRS | AsyncIter | Readable;
8
9
 
9
10
  export type { AsyncIter, Bin, Streamable, WebRS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d0paminedriven/fs",
3
- "version": "7.3.0",
3
+ "version": "7.4.0",
4
4
  "homepage": "https://github.com/DopamineDriven/d0paminedriven/blob/master/packages/fs/README.md",
5
5
  "author": {
6
6
  "email": "andrew@windycitydevs.io",
@@ -109,8 +109,8 @@
109
109
  "tsx": "^4.20.4",
110
110
  "typescript": "^5.9.2",
111
111
  "typescript-eslint": "^8.40.0",
112
- "@d0paminedriven/eslint-config": "0.1.0",
113
112
  "@d0paminedriven/prettier-config": "0.1.0",
113
+ "@d0paminedriven/eslint-config": "0.1.0",
114
114
  "@d0paminedriven/tsconfig": "0.1.0"
115
115
  },
116
116
  "prettier": "@d0paminedriven/prettier-config",