@d0paminedriven/fs 11.0.0 → 12.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.
Files changed (41) hide show
  1. package/dist/docs/index.d.ts +42 -10
  2. package/dist/docs/index.js +177 -41
  3. package/dist/extract/client.d.ts +13 -11
  4. package/dist/extract/client.js +2 -4
  5. package/dist/extract/index.d.ts +7 -10
  6. package/dist/extract/index.js +6 -8
  7. package/dist/fs/index.d.ts +7 -11
  8. package/dist/fs/index.js +15 -14
  9. package/dist/fs-atomic/index.d.ts +3 -9
  10. package/dist/fs-atomic/index.js +17 -11
  11. package/dist/fs-base/index.d.ts +8 -10
  12. package/dist/fs-base/index.js +36 -27
  13. package/dist/fs-core/index.d.ts +5 -9
  14. package/dist/fs-core/index.js +5 -6
  15. package/dist/fs-fetch/index.d.ts +6 -9
  16. package/dist/fs-fetch/index.js +64 -27
  17. package/dist/fs-size/index.d.ts +2 -6
  18. package/dist/fs-size/index.js +8 -9
  19. package/dist/fs-tmp/index.d.ts +7 -11
  20. package/dist/fs-tmp/index.js +7 -8
  21. package/dist/images/index.d.ts +44 -48
  22. package/dist/images/index.js +9 -15
  23. package/dist/images/workup.d.ts +5 -9
  24. package/dist/images/workup.js +4 -5
  25. package/dist/index.d.ts +42 -14
  26. package/dist/index.js +14 -15
  27. package/dist/ld/index.d.ts +1 -5
  28. package/dist/ld/index.js +2 -4
  29. package/dist/mime/index.d.ts +20 -20
  30. package/dist/mime/index.js +4 -4
  31. package/dist/mixins/index.d.ts +9 -13
  32. package/dist/mixins/index.js +6 -6
  33. package/dist/types/index.d.ts +105 -90
  34. package/dist/types/index.js +2 -3
  35. package/dist/types/stream.d.ts +5 -9
  36. package/dist/types/stream.js +1 -1
  37. package/dist/url/index.d.ts +6 -10
  38. package/dist/url/index.js +2 -4
  39. package/dist/utils/index.d.ts +5 -9
  40. package/dist/utils/index.js +2 -4
  41. package/package.json +18 -18
@@ -1,15 +1,12 @@
1
+ import Stream from "stream";
2
+ import { ObjectEncodingOptions } from "fs";
1
3
  import { DocMetadataExtractor } from "../docs/index.js";
2
4
  import { ImgMetadataExtractor } from "../images/index.js";
3
- import { ObjectEncodingOptions } from "fs";
4
- import * as stream0 from "stream";
5
- import Stream from "stream";
6
-
7
- //#region src/types/index.d.ts
8
- type BufferEncodingUnion = Exclude<CTR<ObjEncodingOptions, "encoding">["encoding"], null>;
9
- interface Dict<T> {
5
+ export type BufferEncodingUnion = Exclude<CTR<ObjEncodingOptions, "encoding">["encoding"], null>;
6
+ export interface Dict<T> {
10
7
  [key: string]: T | undefined;
11
8
  }
12
- interface ProcessEnv extends Dict<string> {
9
+ export interface ProcessEnv extends Dict<string> {
13
10
  readonly VERCEL_ENV: typeof process.env.VERCEL_ENV;
14
11
  readonly NODE_ENV: typeof process.env.NODE_ENV;
15
12
  /**
@@ -17,13 +14,13 @@ interface ProcessEnv extends Dict<string> {
17
14
  */
18
15
  TZ?: string;
19
16
  }
20
- interface ProcessEnvOptions {
17
+ export interface ProcessEnvOptions {
21
18
  uid?: number | undefined;
22
19
  gid?: number | undefined;
23
20
  cwd?: string | URL | undefined;
24
21
  env?: ProcessEnv | undefined;
25
22
  }
26
- interface CommonOptions extends ProcessEnvOptions {
23
+ export interface CommonOptions extends ProcessEnvOptions {
27
24
  /**
28
25
  * @default false
29
26
  */
@@ -33,12 +30,12 @@ interface CommonOptions extends ProcessEnvOptions {
33
30
  */
34
31
  timeout?: number | undefined;
35
32
  }
36
- type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
37
- type Signals = "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
38
- type ArrayBufferView = DataView | TypedArray;
39
- type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
40
- type StdioOptions = IOType | (IOType | "ipc" | stream0.Stream | number | null | undefined)[];
41
- interface CommonExecOptions extends CommonOptions {
33
+ export type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array;
34
+ export type Signals = "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
35
+ export type ArrayBufferView = DataView | TypedArray;
36
+ export type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
37
+ export type StdioOptions = IOType | (IOType | "ipc" | import("stream").Stream | number | null | undefined)[];
38
+ export interface CommonExecOptions extends CommonOptions {
42
39
  input?: string | ArrayBufferView | undefined;
43
40
  /**
44
41
  * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
@@ -53,25 +50,25 @@ interface CommonExecOptions extends CommonOptions {
53
50
  maxBuffer?: number | undefined;
54
51
  encoding?: BufferEncoding | "buffer" | null | undefined;
55
52
  }
56
- interface ExecSyncOptions extends CommonExecOptions {
53
+ export interface ExecSyncOptions extends CommonExecOptions {
57
54
  shell?: string | undefined;
58
55
  }
59
- interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
56
+ export interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
60
57
  encoding: BufferEncoding;
61
58
  }
62
- interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
59
+ export interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
63
60
  encoding?: "buffer" | null | undefined;
64
61
  }
65
- interface ObjEncodingOptions extends ObjectEncodingOptions {}
66
- type OpenMode = string | number;
67
- interface Abortable {
62
+ export interface ObjEncodingOptions extends ObjectEncodingOptions {}
63
+ export type OpenMode = string | number;
64
+ export interface Abortable {
68
65
  /**
69
66
  * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
70
67
  */
71
68
  signal?: AbortSignal | undefined;
72
69
  }
73
- type Mode = string | number;
74
- interface MkDirOptions {
70
+ export type Mode = string | number;
71
+ export interface MkDirOptions {
75
72
  /**
76
73
  * Indicates whether parent folders should be created.
77
74
  * If a folder was created, the path to the first created folder will be returned.
@@ -84,13 +81,13 @@ interface MkDirOptions {
84
81
  */
85
82
  mode?: Mode | undefined;
86
83
  }
87
- type BashEnv = "development" | "production" | "test" | undefined;
88
- type WriteStreamProps<T extends string = string> = {
84
+ export type BashEnv = "development" | "production" | "test" | undefined;
85
+ export type WriteStreamProps<T extends string = string> = {
89
86
  data: WriteableDataType;
90
87
  cwd: string;
91
88
  path: T;
92
89
  };
93
- type WriteStreamOptions = XOR<BufferEncodingUnion, {
90
+ export type WriteStreamOptions = XOR<BufferEncodingUnion, {
94
91
  encoding?: BufferEncodingUnion;
95
92
  autoClose?: boolean;
96
93
  emitClose?: boolean;
@@ -98,19 +95,19 @@ type WriteStreamOptions = XOR<BufferEncodingUnion, {
98
95
  highWaterMark?: number;
99
96
  flush?: boolean;
100
97
  }>;
101
- type WriteableDataType = string | Buffer | NodeJS.TypedArray | NodeJS.NonSharedDataView;
102
- type WriteFileAsyncDataType = string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream;
103
- interface ReadDirOptionsEntity extends ObjEncodingOptions {
98
+ export type WriteableDataType = string | Buffer | NodeJS.TypedArray | NodeJS.NonSharedDataView;
99
+ export type WriteFileAsyncDataType = string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream;
100
+ export interface ReadDirOptionsEntity extends ObjEncodingOptions {
104
101
  withFileTypes?: false | undefined;
105
102
  recursive?: boolean | undefined;
106
103
  }
107
- type ReadDirOptions = { [P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P] };
108
- type WriteFileAsyncOptions = XOR<ObjEncodingOptions & {
104
+ export type ReadDirOptions = { [P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P]; };
105
+ export type WriteFileAsyncOptions = XOR<ObjEncodingOptions & {
109
106
  mode?: Mode | undefined;
110
107
  flag?: OpenMode | undefined;
111
108
  flush?: boolean | undefined;
112
109
  } & Abortable, BufferEncodingUnion> | null;
113
- type WriteFileAsyncProps<T extends string = string> = {
110
+ export type WriteFileAsyncProps<T extends string = string> = {
114
111
  path: T;
115
112
  data: WriteableDataType;
116
113
  options?: (ObjEncodingOptions & {
@@ -119,7 +116,7 @@ type WriteFileAsyncProps<T extends string = string> = {
119
116
  flush?: boolean | undefined;
120
117
  } & Abortable) | BufferEncodingUnion | null;
121
118
  };
122
- type RmOptions = {
119
+ export type RmOptions = {
123
120
  /**
124
121
  * When `true`, exceptions will be ignored if `path` does not exist.
125
122
  * @default true
@@ -147,62 +144,62 @@ type RmOptions = {
147
144
  */
148
145
  retryDelay?: number | undefined;
149
146
  };
150
- type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
151
- type ReadDirProps<T extends string> = {
147
+ export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
148
+ export type ReadDirProps<T extends string> = {
152
149
  path: T;
153
150
  options?: ReadDirOptions;
154
151
  };
155
- type MkDirSyncOptions = Mode | (MkDirOptions & {
152
+ export type MkDirSyncOptions = Mode | (MkDirOptions & {
156
153
  recursive?: boolean | undefined;
157
154
  }) | null | undefined;
158
- type MkDirSyncProps<T extends string> = {
155
+ export type MkDirSyncProps<T extends string> = {
159
156
  cwd: string;
160
157
  path: T;
161
158
  options?: Mode | (MkDirOptions & {
162
159
  recursive?: boolean | undefined;
163
160
  }) | null | undefined;
164
161
  };
165
- interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBufferEncoding {
162
+ export interface ExecuteCommandProps<T extends string> extends ExecSyncOptionsWithBufferEncoding {
166
163
  command: T;
167
164
  }
168
- type ConditionalPromise<T> = T | Promise<T>;
169
- type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
170
- type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
171
- type Rm<T, P$1 extends keyof T = keyof T> = { [S in keyof T as Exclude<S, P$1>]: T[S] };
165
+ export type ConditionalPromise<T> = T | Promise<T>;
166
+ export type UnwrapPromise<T> = T extends Promise<infer U> | PromiseLike<infer U> ? U : T;
167
+ export type Unenumerate<T> = T extends (infer U)[] | readonly (infer U)[] ? U : T;
168
+ export type Rm<T, P extends keyof T = keyof T> = { [S in keyof T as Exclude<S, P>]: T[S]; };
172
169
  /**
173
170
  * helper workup for use in XOR type below
174
171
  * makes properties from U optional and undefined in T, and vice versa
175
172
  */
176
- type Without<T, U$1> = { [P in Exclude<keyof T, keyof U$1>]?: never };
173
+ export type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never; };
177
174
  /**
178
175
  * enforces mutual exclusivity of T | U
179
176
  */
180
- type XOR<T, U$1> = [T, U$1] extends [object, object] ? (Without<T, U$1> & U$1) | (Without<U$1, T> & T) : T | U$1;
177
+ export type XOR<T, U> = [T, U] extends [object, object] ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
181
178
  /**
182
179
  * Conditional to Required
183
180
  */
184
- type CTR<T, K$1 extends keyof OnlyOptional<T> = keyof OnlyOptional<T>> = Rm<T, K$1> & { [Q in K$1]-?: T[Q] };
181
+ export type CTR<T, K extends keyof OnlyOptional<T> = keyof OnlyOptional<T>> = Rm<T, K> & { [Q in K]-?: T[Q]; };
185
182
  /**
186
183
  * Required to Conditional
187
184
  */
188
- type RTC<T, K$1 extends keyof OnlyRequired<T> = keyof OnlyRequired<T>> = Rm<T, K$1> & { [Q in K$1]?: T[Q] };
189
- type IsExact<T, U$1> = [T] extends [U$1] ? [U$1] extends [T] ? true : false : false;
185
+ export type RTC<T, K extends keyof OnlyRequired<T> = keyof OnlyRequired<T>> = Rm<T, K> & { [Q in K]?: T[Q]; };
186
+ export type IsExact<T, U> = [T] extends [U] ? [U] extends [T] ? true : false : false;
190
187
  /**
191
188
  * To Conditionally never
192
189
  */
193
- type TCN<T, X$1 extends keyof T = keyof T> = Rm<T, X$1> & { [Q in X$1]?: XOR<T[Q], never> };
194
- type ArrFieldReplacer<T extends unknown[] | readonly unknown[], V extends keyof Unenumerate<T>, Q$1 extends boolean = false, P$1 = unknown> = T extends (infer U)[] | readonly (infer U)[] ? V extends keyof U ? Q$1 extends true ? P$1 extends Record<infer Y, infer X> ? (Rm<U, V> & Record<Y, X>)[] : (Rm<U, V> & P$1)[] : Q$1 extends false ? Rm<U, V>[] : U : T : T;
195
- type IsOptional<T, K$1 extends keyof T> = undefined extends T[K$1] ? object extends Pick<T, K$1> ? true : false : false;
196
- type OnlyOptional<T> = { [K in keyof T as IsOptional<T, K> extends true ? K : never]: T[K] };
197
- type OnlyRequired<T> = { [K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K] };
190
+ export type TCN<T, X extends keyof T = keyof T> = Rm<T, X> & { [Q in X]?: XOR<T[Q], never>; };
191
+ export type ArrFieldReplacer<T extends unknown[] | readonly unknown[], V extends keyof Unenumerate<T>, Q extends boolean = false, P = unknown> = T extends (infer U)[] | readonly (infer U)[] ? V extends keyof U ? Q extends true ? P extends Record<infer Y, infer X> ? (Rm<U, V> & Record<Y, X>)[] : (Rm<U, V> & P)[] : Q extends false ? Rm<U, V>[] : U : T : T;
192
+ export type IsOptional<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? true : false : false;
193
+ export type OnlyOptional<T> = { [K in keyof T as IsOptional<T, K> extends true ? K : never]: T[K]; };
194
+ export type OnlyRequired<T> = { [K in keyof T as IsOptional<T, K> extends false ? K : never]: T[K]; };
198
195
  /**
199
196
  * Expect that the thing passed to Expect<T> is true.
200
197
  *
201
198
  * For instance, `Expect<true>` won't error. But
202
199
  * `Expect<false>` will error.
203
200
  */
204
- type Expect<T extends true> = T;
205
- type RemoveFields<T, P$1 extends keyof T = keyof T> = { [S in keyof T as Exclude<S, P$1>]: T[S] };
201
+ export type Expect<T extends true> = T;
202
+ export type RemoveFields<T, P extends keyof T = keyof T> = { [S in keyof T as Exclude<S, P>]: T[S]; };
206
203
  /**
207
204
  * Checks that X and Y are exactly equal.
208
205
  *
@@ -214,7 +211,7 @@ type RemoveFields<T, P$1 extends keyof T = keyof T> = { [S in keyof T as Exclude
214
211
  * is true. But `Equal<{ a: string; b: string }, { a: string; } & { b: string }>`
215
212
  * is false.
216
213
  */
217
- type Equal<X$1, Y$1> = (<T>() => T extends X$1 ? 1 : 2) extends (<T>() => (T extends Y$1 ? 1 : 2)) ? true : false;
214
+ export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
218
215
  /**
219
216
  * Checks that Y is assignable to X.
220
217
  *
@@ -224,23 +221,23 @@ type Equal<X$1, Y$1> = (<T>() => T extends X$1 ? 1 : 2) extends (<T>() => (T ext
224
221
  * But `Extends<'a', string>` is false. This is because a string
225
222
  * CANNOT be passed to a function which expects 'a'.
226
223
  */
227
- type Extends<X$1, Y$1> = Y$1 extends X$1 ? true : false;
228
- type DX<Y$1> = { [P in keyof Y$1]: Y$1[P] };
229
- type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T;
230
- type DeepPartialFields<T, K$1 extends keyof T> = Omit<T, K$1> & { [P in K$1]?: DeepPartial<T[P]> };
231
- type DeepReplace<T, From, To> = T extends From ? To : T extends object ? { [K in keyof T]: DeepReplace<T[K], From, To> } : T;
232
- type RequireNested<T, Path extends string> = Path extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rm<T, K> & Record<K, RequireNested<Required<T>[K], Rest>> : T : Path extends keyof T ? Rm<T, Path> & Record<Path, Required<T>[Path]> : T;
233
- type ConditionalToRequired<T, Z extends keyof T = keyof T> = Rm<T, Z> & { [Q in Z]-?: T[Q] };
234
- type RequiredToConditional<T, X$1 extends keyof T = keyof T> = Rm<T, X$1> & { [Q in X$1]?: T[Q] };
235
- type FieldToConditionallyNever<T, X$1 extends keyof T = keyof T> = Rm<T, X$1> & { [Q in X$1]?: XOR<T[Q], never> };
236
- type ExcludeFieldEnumerable<T, K$1 extends keyof T> = Rm<T, K$1>;
237
- type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
238
- type Depth<Y$1 extends {
224
+ export type Extends<X, Y> = Y extends X ? true : false;
225
+ export type DX<Y> = { [P in keyof Y]: Y[P]; };
226
+ export type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
227
+ export type DeepPartialFields<T, K extends keyof T> = Omit<T, K> & { [P in K]?: DeepPartial<T[P]>; };
228
+ export type DeepReplace<T, From, To> = T extends From ? To : T extends object ? { [K in keyof T]: DeepReplace<T[K], From, To>; } : T;
229
+ export type RequireNested<T, Path extends string> = Path extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rm<T, K> & Record<K, RequireNested<Required<T>[K], Rest>> : T : Path extends keyof T ? Rm<T, Path> & Record<Path, Required<T>[Path]> : T;
230
+ export type ConditionalToRequired<T, Z extends keyof T = keyof T> = Rm<T, Z> & { [Q in Z]-?: T[Q]; };
231
+ export type RequiredToConditional<T, X extends keyof T = keyof T> = Rm<T, X> & { [Q in X]?: T[Q]; };
232
+ export type FieldToConditionallyNever<T, X extends keyof T = keyof T> = Rm<T, X> & { [Q in X]?: XOR<T[Q], never>; };
233
+ export type ExcludeFieldEnumerable<T, K extends keyof T> = Rm<T, K>;
234
+ export type ArrayOrReadOnlyArray<T> = T[] | readonly T[];
235
+ export type Depth<Y extends {
239
236
  [record: string | symbol | number]: unknown;
240
- }, X$1 extends keyof Y$1 = keyof Y$1> = { [H in keyof Y$1[X$1]]: Y$1[X$1][H][keyof Y$1[X$1][H]] };
241
- type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
242
- type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
243
- type InjectScriptsProps<T> = {
237
+ }, X extends keyof Y = keyof Y> = { [H in keyof Y[X]]: Y[X][H][keyof Y[X][H]]; };
238
+ export type InferDepth<T> = T extends Depth<infer U, infer X> ? U[X] : T;
239
+ export type OmitSrc<T> = T extends `src/${infer U}` ? U : T;
240
+ export type InjectScriptsProps<T> = {
244
241
  content: {
245
242
  scripts: {
246
243
  [record: string]: string;
@@ -252,7 +249,7 @@ type InjectScriptsProps<T> = {
252
249
  };
253
250
  tuplesToInject: T;
254
251
  };
255
- type ParsedUrlInfo = {
252
+ export type ParsedUrlInfo = {
256
253
  href: string;
257
254
  protocol: string;
258
255
  baseUrl: string;
@@ -261,7 +258,7 @@ type ParsedUrlInfo = {
261
258
  search: string;
262
259
  hash: string;
263
260
  };
264
- declare const unitsObj: {
261
+ export declare const unitsObj: {
265
262
  readonly PB: 5;
266
263
  readonly TB: 4;
267
264
  readonly GB: 3;
@@ -269,12 +266,12 @@ declare const unitsObj: {
269
266
  readonly KB: 1;
270
267
  readonly B: 0;
271
268
  };
272
- type Unit = keyof typeof unitsObj;
273
- type SizeOpts = {
269
+ export type Unit = keyof typeof unitsObj;
270
+ export type SizeOpts = {
274
271
  decimals?: number;
275
272
  includeUnits?: boolean;
276
273
  };
277
- interface ImageSpecs {
274
+ export interface ImageSpecs {
278
275
  type: "IMAGE";
279
276
  width: number;
280
277
  height: number;
@@ -290,11 +287,11 @@ interface ImageSpecs {
290
287
  exifDateTimeOriginal: string | null;
291
288
  metadata?: Record<string, string>;
292
289
  }
293
- interface BoxInfo {
290
+ export interface BoxInfo {
294
291
  pos: number;
295
292
  size: number;
296
293
  }
297
- interface PdfDocSpecs {
294
+ export interface PdfDocSpecs {
298
295
  pdfVersion: string | null;
299
296
  isEncrypted: boolean | null;
300
297
  isSearchable: boolean | null;
@@ -310,7 +307,7 @@ interface PdfDocSpecs {
310
307
  annotating: boolean;
311
308
  } | null;
312
309
  }
313
- interface SpreadSheetDocSpecs {
310
+ export interface SpreadSheetDocSpecs {
314
311
  sheetCount: number | null;
315
312
  sheetNames: string[] | null;
316
313
  hasFormulas: boolean | null;
@@ -319,7 +316,7 @@ interface SpreadSheetDocSpecs {
319
316
  hasCharts: boolean | null;
320
317
  activeSheet: number | null;
321
318
  }
322
- interface PresentationDocSpecs {
319
+ export interface PresentationDocSpecs {
323
320
  slideCount: number | null;
324
321
  hasAnimations: boolean | null;
325
322
  hasTransitions: boolean | null;
@@ -327,7 +324,18 @@ interface PresentationDocSpecs {
327
324
  hasMasterSlides: boolean | null;
328
325
  presentationFormat: "standard" | "widescreen" | null;
329
326
  }
330
- interface DocSpecs {
327
+ export type PdfCommonImagesUnion = "jpeg" | "jpeg2000" | "png-like" | "ccitt-fax" | "jbig2" | "inline";
328
+ export type PdfImageCoverEstUnion = "none" | "moderate" | "minimal" | "heavy";
329
+ export interface PdfImageAnalysisMetadata {
330
+ hasImages: boolean;
331
+ imageCount: number;
332
+ estimatedImageCoverage: PdfImageCoverEstUnion;
333
+ isLikelyScanned: boolean;
334
+ hasVectorGraphics: boolean;
335
+ recommendation: "multimodal" | "text-only";
336
+ imageTypes: PdfCommonImagesUnion[];
337
+ }
338
+ export interface DocSpecs<T = unknown> {
331
339
  type: "DOCUMENT";
332
340
  format: string | null;
333
341
  mimeType: string | null;
@@ -346,32 +354,33 @@ interface DocSpecs {
346
354
  textPreview: string | null;
347
355
  createdDate: string | null;
348
356
  modifiedDate: string | null;
357
+ metadata?: T;
349
358
  }
350
- type ZipEntry = {
359
+ export type ZipEntry = {
351
360
  name: string;
352
361
  compressedSize: number;
353
362
  uncompressedSize: number;
354
363
  compressionMethod: number;
355
364
  localHeaderOffset: number;
356
365
  };
357
- interface ExpandedImgSpecs extends ImageSpecs {
366
+ export interface ExpandedImgSpecs extends ImageSpecs {
358
367
  source?: string;
359
368
  fetchedBytes?: number;
360
369
  byteSize?: number;
361
370
  contentType?: string;
362
371
  }
363
- interface ExpandedDocSpecs extends DocSpecs {
372
+ export interface ExpandedDocSpecs<T = unknown> extends DocSpecs<T> {
364
373
  source?: string;
365
374
  fetchedBytes?: number;
366
375
  byteSize?: number;
367
376
  contentType?: string;
368
377
  }
369
- type Constructor<A extends any[] = any[], I = object> = new (...args: A) => I;
370
- interface ExtractorOptions {
378
+ export type Constructor<A extends any[] = any[], I = object> = new (...args: A) => I;
379
+ export interface ExtractorOptions {
371
380
  img?: ImgMetadataExtractor;
372
381
  docs?: DocMetadataExtractor;
373
382
  }
374
- interface ExtractorHardenedOptions extends ExtractorOptions {
383
+ export interface ExtractorHardenedOptions extends ExtractorOptions {
375
384
  headers?: {
376
385
  [key: string]: string;
377
386
  };
@@ -390,6 +399,12 @@ interface ExtractorHardenedOptions extends ExtractorOptions {
390
399
  /** Enable verbose debug logging */
391
400
  debug?: boolean;
392
401
  }
393
- //#endregion
394
- export { Abortable, ArrFieldReplacer, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BoxInfo, BufferEncodingUnion, CTR, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Constructor, DX, DeepPartial, DeepPartialFields, DeepReplace, Depth, Dict, DocSpecs, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, ExpandedDocSpecs, ExpandedImgSpecs, Expect, Extends, ExtractorHardenedOptions, ExtractorOptions, FieldToConditionallyNever, IOType, ImageSpecs, InferDepth, InjectScriptsProps, IsExact, IsOptional, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, NoParamCallback, ObjEncodingOptions, OmitSrc, OnlyOptional, OnlyRequired, OpenMode, ParsedUrlInfo, PdfDocSpecs, PresentationDocSpecs, ProcessEnv, ProcessEnvOptions, RTC, ReadDirOptions, ReadDirOptionsEntity, ReadDirProps, RemoveFields, RequireNested, RequiredToConditional, Rm, RmOptions, Signals, SizeOpts, SpreadSheetDocSpecs, StdioOptions, TCN, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataType, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamOptions, WriteStreamProps, WriteableDataType, XOR, ZipEntry, unitsObj };
402
+ export type CommonDiscriminants = "type" | "kind" | "event" | "tag" | "_tag" | "__typename";
403
+ export type LiteralUnion<TKnown extends string> = TKnown | (string & {});
404
+ export type DiscriminatedUnionToRecord<TUnion extends Record<TKey, string>, TKey extends string = LiteralUnion<CommonDiscriminants>> = TKey extends keyof TUnion ? { [K in TUnion[TKey] & string]: Extract<TUnion, Record<TKey, K>>; } : never;
405
+ export type UnionToRecord<TUnion extends {
406
+ type: string;
407
+ }, TDiscriminant extends string = TUnion["type"]> = { [K in TDiscriminant]: Extract<TUnion, {
408
+ type: K;
409
+ }>; };
395
410
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- //#region src/types/index.ts
1
+ // src/types/index.ts
2
2
  const unitsObj = {
3
3
  PB: 5,
4
4
  TB: 4,
@@ -7,7 +7,6 @@ const unitsObj = {
7
7
  KB: 1,
8
8
  B: 0
9
9
  };
10
-
11
- //#endregion
12
10
  export { unitsObj };
11
+
13
12
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,8 @@
1
- import { Readable } from "node:stream";
2
1
  import { ReadableStream } from "stream/web";
3
-
4
- //#region src/types/stream.d.ts
5
- type Bin = Buffer | Uint8Array;
6
- type WebRS = ReadableStream<Uint8Array>;
7
- type AsyncIter = AsyncIterable<Uint8Array>;
2
+ import { Readable } from "node:stream";
3
+ export type Bin = Buffer | Uint8Array;
4
+ export type WebRS = ReadableStream<Uint8Array>;
5
+ export type AsyncIter = AsyncIterable<Uint8Array>;
8
6
  /** Inputs you actually accept — no `any`, no lies. */
9
- type Streamable = string | Bin | WebRS | AsyncIter | Readable;
10
- //#endregion
11
- export { AsyncIter, Bin, Streamable, WebRS };
7
+ export type Streamable = string | Bin | WebRS | AsyncIter | Readable;
12
8
  //# sourceMappingURL=stream.d.ts.map
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1,10 +1,8 @@
1
1
  import { UtilsService } from "../utils/index.js";
2
-
3
- //#region src/url/index.d.ts
4
- type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
5
- type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
6
- type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
7
- type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXTENSION";
2
+ export type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
3
+ export type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
4
+ export type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
5
+ export type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXTENSION";
8
6
  /**
9
7
  * usage
10
8
  *
@@ -14,8 +12,8 @@ type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXT
14
12
  *
15
13
  * ```
16
14
  */
17
- type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
18
- declare class UrlService extends UtilsService {
15
+ export type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
16
+ export declare class UrlService extends UtilsService {
19
17
  private URL_REGEX;
20
18
  parseUrl(url: string): {
21
19
  href: string;
@@ -27,6 +25,4 @@ declare class UrlService extends UtilsService {
27
25
  hash: string;
28
26
  } | null;
29
27
  }
30
- //#endregion
31
- export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService };
32
28
  //# sourceMappingURL=index.d.ts.map
package/dist/url/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { UtilsService } from "../utils/index.js";
2
-
3
- //#region src/url/index.ts
2
+ // src/url/index.ts
4
3
  var UrlService = class extends UtilsService {
5
4
  URL_REGEX = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
6
5
  parseUrl(url) {
@@ -17,7 +16,6 @@ var UrlService = class extends UtilsService {
17
16
  else return null;
18
17
  }
19
18
  };
20
-
21
- //#endregion
22
19
  export { UrlService };
20
+
23
21
  //# sourceMappingURL=index.js.map
@@ -1,23 +1,19 @@
1
- import { RemoveFields } from "../types/index.js";
1
+ import { RemoveFields, Unenumerate } from "../types/index.js";
2
2
  import { LevenshteinDistance } from "../ld/index.js";
3
-
4
- //#region src/utils/index.d.ts
5
- declare class UtilsService extends LevenshteinDistance {
3
+ export declare class UtilsService extends LevenshteinDistance {
6
4
  constructor();
7
5
  chunkArray<T extends number>(arr: string[], maxChunkLength: T): string[][];
8
6
  b64ToBlob<const T extends string>(b64Data: T): Blob;
9
7
  arrToArrOfArrs: <const T>(arr: T[], int?: number, agg?: T[][]) => T[][];
10
8
  extractTuple<const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T>(obj: T, props: V): readonly [V, T[V]];
11
9
  sort<const S extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const K extends "ASC" | "DESC" | undefined>(obj: S, order?: K): S;
12
- excludeTargeted: <const T extends Enumerator<unknown> | Record<string | number | symbol, unknown>, const V extends keyof T, const S extends "ASC" | "DESC" | undefined>(obj: T, props: V[], sort?: S | undefined) => RemoveFields<T, V>;
13
- includeTargeted: <const T extends Enumerator<unknown> | Record<string | number | symbol, unknown>, const V extends keyof T, const S extends "ASC" | "DESC" | undefined>(obj: T, props: V[], sort?: S | undefined) => Pick<T, V>;
14
- countsSorter: <const T extends object>(counter: T, keySort?: "ASC" | "DESC", valSort?: "ASC" | "DESC") => {
10
+ excludeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => RemoveFields<T, Unenumerate<typeof props>>;
11
+ includeTargeted: <const T extends Record<string | number | symbol, unknown> | Enumerator<unknown>, const V extends keyof T, const S extends Parameters<typeof this.sort>["1"]>(obj: T, props: V[], sort?: S) => Pick<T, Unenumerate<typeof props>>;
12
+ countsSorter: <const T extends object>(counter: T, keySort?: "ASC" | "DESC", valSort?: "DESC" | "ASC") => {
15
13
  [k: string]: any;
16
14
  };
17
15
  range(from: number, to: number): number[];
18
16
  isPrimeNumber: <const T extends number>(n: T) => boolean;
19
17
  acceptor: (num: number) => number[];
20
18
  }
21
- //#endregion
22
- export { UtilsService };
23
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { LevenshteinDistance } from "../ld/index.js";
2
-
3
- //#region src/utils/index.ts
2
+ // src/utils/index.ts
4
3
  var UtilsService = class extends LevenshteinDistance {
5
4
  constructor() {
6
5
  super();
@@ -78,7 +77,6 @@ var UtilsService = class extends LevenshteinDistance {
78
77
  };
79
78
  acceptor = (num) => [...Array(num !== 0 ? num : this.range(num = -101, num = 101)).keys()].reverse().filter(this.isPrimeNumber);
80
79
  };
81
-
82
- //#endregion
83
80
  export { UtilsService };
81
+
84
82
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d0paminedriven/fs",
3
- "version": "11.0.0",
3
+ "version": "12.1.0",
4
4
  "homepage": "https://github.com/DopamineDriven/d0paminedriven/blob/master/packages/fs/README.md",
5
5
  "author": "Andrew Ross",
6
6
  "description": "convenient fs helpers",
@@ -114,27 +114,27 @@
114
114
  "./utils": "./dist/utils/index.js"
115
115
  },
116
116
  "dependencies": {
117
- "dotenv": "^17.2.3",
118
- "dotenv-expand": "^12.0.3",
119
- "fflate": "^0.8.2"
117
+ "@d0paminedriven/mimedown": "^0.2.0",
118
+ "@d0paminedriven/pdfdown": "^0.18.0",
119
+ "dotenv": "^18.0.10",
120
+ "dotenv-expand": "^1000.0.0",
121
+ "fflate": "^0.8.3"
120
122
  },
121
123
  "devDependencies": {
122
- "@types/node": "^24.10.1",
123
- "@typescript/native-preview": "7.0.0-dev.20251206.1",
124
- "chokidar": "^5.0.0",
125
- "dotenv-cli": "^11.0.0",
126
- "eslint": "^9.39.1",
127
- "jiti": "^2.6.1",
128
- "prettier": "^3.7.4",
129
- "terser": "^5.44.1",
130
- "tsdown": "^0.17.0",
131
- "tslib": "^2.8.1",
132
- "tsx": "^4.21.0",
133
- "typescript": "^5.9.3",
134
- "typescript-eslint": "^8.47.0",
135
124
  "@d0paminedriven/eslint-config": "0.1.0",
125
+ "@d0paminedriven/prettier-config": "0.1.0",
136
126
  "@d0paminedriven/tsconfig": "0.1.0",
137
- "@d0paminedriven/prettier-config": "0.1.0"
127
+ "@types/node": "^26.6.6",
128
+ "@typescript/native-preview": "^7.0.0-dev.20260707.2",
129
+ "dotenv-cli": "^11.1.0",
130
+ "eslint": "^10.15.0",
131
+ "jiti": "^2.7.0",
132
+ "prettier": "^3.10.1",
133
+ "tsdown": "^0.23.7",
134
+ "tslib": "^2.9.1",
135
+ "tsx": "^4.23.15",
136
+ "typescript": "^6.0.3",
137
+ "typescript-eslint": "^8.73.0"
138
138
  },
139
139
  "prettier": "@d0paminedriven/prettier-config",
140
140
  "scripts": {