@d0paminedriven/fs 10.0.0 → 11.0.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 (60) hide show
  1. package/dist/docs/index.d.ts +119 -0
  2. package/dist/docs/index.js +1027 -0
  3. package/dist/extract/client.d.ts +54 -0
  4. package/dist/extract/client.js +118 -0
  5. package/dist/extract/index.d.ts +69 -0
  6. package/dist/extract/index.js +622 -0
  7. package/dist/fs/index.d.ts +19 -55
  8. package/dist/fs/index.js +88 -19
  9. package/dist/fs-atomic/index.d.ts +28 -36
  10. package/dist/fs-atomic/index.js +88 -13
  11. package/dist/fs-base/index.d.ts +105 -111
  12. package/dist/fs-base/index.js +188 -12
  13. package/dist/fs-core/index.d.ts +20 -24
  14. package/dist/fs-core/index.js +44 -16
  15. package/dist/fs-fetch/index.d.ts +48 -62
  16. package/dist/fs-fetch/index.js +146 -18
  17. package/dist/fs-size/index.d.ts +16 -28
  18. package/dist/fs-size/index.js +64 -15
  19. package/dist/fs-tmp/index.d.ts +179 -192
  20. package/dist/fs-tmp/index.js +321 -17
  21. package/dist/images/index.d.ts +447 -0
  22. package/dist/images/index.js +899 -0
  23. package/dist/images/workup.d.ts +30 -0
  24. package/dist/images/workup.js +317 -0
  25. package/dist/index.d.ts +20 -22
  26. package/dist/index.js +20 -64
  27. package/dist/ld/index.d.ts +15 -13
  28. package/dist/ld/index.js +56 -6
  29. package/dist/mime/index.d.ts +299 -294
  30. package/dist/mime/index.js +348 -13
  31. package/dist/mixins/index.d.ts +34 -0
  32. package/dist/mixins/index.js +54 -0
  33. package/dist/types/index.d.ts +279 -215
  34. package/dist/types/index.js +11 -6
  35. package/dist/types/stream.d.ts +6 -4
  36. package/dist/types/stream.js +1 -1
  37. package/dist/url/index.d.ts +15 -18
  38. package/dist/url/index.js +21 -8
  39. package/dist/utils/index.d.ts +19 -23
  40. package/dist/utils/index.js +82 -7
  41. package/package.json +33 -13
  42. package/dist/chunk-5CACVZVF.js +0 -386
  43. package/dist/chunk-5H6GE5AO.js +0 -14
  44. package/dist/chunk-7JQ56XIH.js +0 -187
  45. package/dist/chunk-7LOAFIZM.js +0 -77
  46. package/dist/chunk-7QVYU63E.js +0 -7
  47. package/dist/chunk-DNR5ZI2T.js +0 -75
  48. package/dist/chunk-L2QMQOEJ.js +0 -366
  49. package/dist/chunk-NJHN5OE3.js +0 -33
  50. package/dist/chunk-OHKRQJZH.js +0 -82
  51. package/dist/chunk-OT5JEQKW.js +0 -139
  52. package/dist/chunk-PATMSIQK.js +0 -367
  53. package/dist/chunk-PB5A7ZFD.js +0 -79
  54. package/dist/chunk-VDKUXJE7.js +0 -240
  55. package/dist/chunk-Y5QWE4EG.js +0 -1335
  56. package/dist/chunk-YRCJWFZD.js +0 -107
  57. package/dist/image/index.d.ts +0 -182
  58. package/dist/image/index.js +0 -13
  59. package/dist/image/workup.d.ts +0 -40
  60. package/dist/image/workup.js +0 -12
@@ -0,0 +1,119 @@
1
+ import { DocSpecs, ZipEntry } from "../types/index.js";
2
+ import { Readable } from "node:stream";
3
+
4
+ //#region src/docs/index.d.ts
5
+ declare class DocMetadataExtractor {
6
+ protected toSafeString(buf: Uint8Array, encoding?: string): string;
7
+ protected detectTextEncodingPrefix(buffer: Uint8Array): {
8
+ encoding: string;
9
+ offset: number;
10
+ };
11
+ protected detectAndDecodeText(buffer: Uint8Array): string;
12
+ private _stripXmlTags;
13
+ private getExtFromFilename;
14
+ private firstN;
15
+ private countWords;
16
+ private countLines;
17
+ private extToLanguage;
18
+ /**
19
+ * Decompress FlateDecode streams to search for page info
20
+ * Many modern PDFs compress their object streams
21
+ */
22
+ private decompressFlateStreams;
23
+ /**
24
+ * Parse Object Streams (/Type /ObjStm) used by Acrobat-optimized PDFs
25
+ * These bundle multiple objects into compressed containers
26
+ */
27
+ private parseObjectStreams;
28
+ /**
29
+ * Parse cross-reference table to find object offsets
30
+ */
31
+ private parseXrefTable;
32
+ /**
33
+ * Parse PDF 1.5+ cross-reference streams (/Type /XRef)
34
+ * These replace traditional xref tables in modern PDFs
35
+ */
36
+ private parseXrefStream;
37
+ /**
38
+ * Extract page count from object at specific offset
39
+ */
40
+ private extractPageCountFromObject;
41
+ /**
42
+ * Strategy 1: Direct /Pages /Count in uncompressed content (fastest, high confidence)
43
+ * Finds the ROOT Pages object by looking for the highest /Count value
44
+ */
45
+ private strategy1DirectPagesCount;
46
+ /**
47
+ * Strategy 2: Linearized hint (high confidence for linearized PDFs)
48
+ * /N in the linearization dict is the total page count
49
+ */
50
+ private strategy2Linearized;
51
+ /**
52
+ * Strategy 3: Follow Catalog -> Pages reference chain (high confidence)
53
+ */
54
+ private strategy3CatalogChain;
55
+ /**
56
+ * Strategy 4: Decompress FlateDecode streams and Object Streams (medium confidence)
57
+ * Handles Acrobat-optimized PDFs where page tree is compressed
58
+ */
59
+ private strategy4DecompressedStreams;
60
+ /**
61
+ * Strategy 5: Count unique Page objects from Kids arrays (medium confidence)
62
+ * Only counts refs that point to actual /Type /Page objects
63
+ */
64
+ private strategy5KidsPageRefs;
65
+ /**
66
+ * Strategy 6: Brute force count /Type /Page objects (low confidence)
67
+ */
68
+ private strategy6BruteForce;
69
+ /**
70
+ * Strategy 7: Estimate from file characteristics (last resort)
71
+ */
72
+ private strategy7Estimate;
73
+ /**
74
+ * Count PDF pages with confidence tracking
75
+ * Returns both the count and how confident we are in the result
76
+ */
77
+ private countPDFPagesWithConfidence;
78
+ /**
79
+ * Legacy method for backward compatibility
80
+ */
81
+ private countPDFPages;
82
+ private extractPDFText;
83
+ private decodePdfString;
84
+ private decodeHexString;
85
+ /**
86
+ * Parse PDF date format into ISO 8601
87
+ * PDF Format: D:YYYYMMDDHHmmSSOHH'mm'
88
+ * Your implementation is good but needs small fixes
89
+ */
90
+ private parsePdfDate;
91
+ private getPdfInfoString;
92
+ /**
93
+ * Extract date fields from PDF - handles all encoding formats
94
+ * This is what you need to call from your main PDF parser
95
+ */
96
+ private extractPdfDate;
97
+ /**
98
+ * Extract dates from XMP metadata packet
99
+ * Used as fallback when traditional PDF Info dictionary lacks dates
100
+ */
101
+ private extractXmpDates;
102
+ parsePdf(buffer: Buffer, mime: string): DocSpecs;
103
+ parseRtf(buffer: Buffer, mime: string): DocSpecs;
104
+ parsePlainText(buffer: Buffer, mime: string, filename?: string): DocSpecs;
105
+ /** ---- Minimal ZIP reader utilities (central directory based) ---- */
106
+ private findEOCD;
107
+ readCentralDirectory(buffer: Buffer): ZipEntry[];
108
+ private parseCentralDirectory;
109
+ private recoverCentralDirectory;
110
+ readLocalFileData(buffer: Buffer, entry: ZipEntry): Uint8Array | null;
111
+ parseOpenXml(buffer: Buffer, mime: string, kind: "docx" | "pptx" | "xlsx"): DocSpecs;
112
+ protected readBytes(stream: Readable): Promise<Buffer<ArrayBufferLike>>;
113
+ extractDocViaStream(stream: Readable, mime: string): Promise<DocSpecs>;
114
+ extractDocViaPath(filePath: string, mime: string): Promise<DocSpecs>;
115
+ getDocumentSpecsWorkup(rawbuffer: Buffer<ArrayBufferLike>, mime: string, filename?: string): DocSpecs;
116
+ }
117
+ //#endregion
118
+ export { DocMetadataExtractor };
119
+ //# sourceMappingURL=index.d.ts.map