@kreuzberg/node 4.6.0 → 4.6.3

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/index.d.ts CHANGED
@@ -1,5 +1,48 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Lazy PDF page iterator. A more memory-efficient alternative to
5
+ * `iteratePdfPagesSync`/`iteratePdfPages` when memory is a concern or when
6
+ * pages should be processed as they are rendered (e.g., sending each page to
7
+ * a vision model for OCR).
8
+ *
9
+ * Renders one page at a time via the `.next()` method. Callers must call
10
+ * `.close()` when done to free native resources.
11
+ *
12
+ * # Example
13
+ *
14
+ * ```javascript
15
+ * const iter = new PdfPageIterator("doc.pdf", 150);
16
+ * let result;
17
+ * while ((result = iter.next()) !== null) {
18
+ * const { pageIndex, data } = result;
19
+ * // process page...
20
+ * }
21
+ * iter.close();
22
+ * ```
23
+ */
24
+ export declare class JsPdfPageIterator {
25
+ /**
26
+ * Create a new PDF page iterator.
27
+ *
28
+ * # Parameters
29
+ *
30
+ * * `file_path` - Path to the PDF file
31
+ * * `dpi` - Optional DPI (default 150)
32
+ */
33
+ constructor(filePath: string, dpi?: number | undefined | null)
34
+ /**
35
+ * Advance the iterator and return the next page.
36
+ *
37
+ * Returns `{ pageIndex, data }` or `null` when exhausted.
38
+ */
39
+ next(): PdfPageResult | null
40
+ /** Total number of pages in the PDF. */
41
+ pageCount(): number
42
+ /** Free native resources. Safe to call multiple times. */
43
+ close(): void
44
+ }
45
+
3
46
  /** Opaque handle to a worker pool */
4
47
  export declare class JsWorkerPool {
5
48
 
@@ -911,6 +954,49 @@ export declare function getValidTokenReductionLevels(): Array<string>
911
954
  */
912
955
  export declare function getWorkerPoolStats(pool: JsWorkerPool): WorkerPoolStats
913
956
 
957
+ /**
958
+ * Create a PDF page iterator and collect all pages (asynchronous).
959
+ *
960
+ * Non-blocking variant of `iteratePdfPagesSync`. Rendering is offloaded
961
+ * to the worker pool.
962
+ *
963
+ * Note: Pages are collected eagerly into an array. For true lazy iteration,
964
+ * use `new PdfPageIterator(filePath, dpi)` which exposes a `.next()` method
965
+ * that renders one page at a time.
966
+ *
967
+ * # Parameters
968
+ *
969
+ * * `file_path` - Path to the PDF file
970
+ * * `dpi` - Optional DPI (default 150)
971
+ *
972
+ * # Returns
973
+ *
974
+ * Promise resolving to an array of `PdfPageResult` objects.
975
+ */
976
+ export declare function iteratePdfPages(filePath: string, dpi?: number | undefined | null): Promise<Array<PdfPageResult>>
977
+
978
+ /**
979
+ * Create a PDF page iterator and collect all pages (synchronous).
980
+ *
981
+ * Opens the PDF once and renders pages lazily, returning an array of
982
+ * `{ pageIndex, data }` objects. Each page is rendered one at a time so
983
+ * only one raw image is in memory at a time.
984
+ *
985
+ * Note: Pages are collected eagerly into an array. For true lazy iteration,
986
+ * use `new PdfPageIterator(filePath, dpi)` which exposes a `.next()` method
987
+ * that renders one page at a time.
988
+ *
989
+ * # Parameters
990
+ *
991
+ * * `file_path` - Path to the PDF file
992
+ * * `dpi` - Optional DPI (default 150)
993
+ *
994
+ * # Returns
995
+ *
996
+ * Array of `PdfPageResult` objects.
997
+ */
998
+ export declare function iteratePdfPagesSync(filePath: string, dpi?: number | undefined | null): Array<PdfPageResult>
999
+
914
1000
  /**
915
1001
  * Hardware acceleration configuration for ONNX Runtime inference.
916
1002
  *
@@ -1055,6 +1141,8 @@ export interface JsExtractionConfig {
1055
1141
  enableQualityProcessing?: boolean
1056
1142
  ocr?: JsOcrConfig
1057
1143
  forceOcr?: boolean
1144
+ /** List of 1-indexed page numbers to force OCR on (None = use force_ocr setting) */
1145
+ forceOcrPages?: Array<number>
1058
1146
  chunking?: JsChunkingConfig
1059
1147
  images?: JsImageExtractionConfig
1060
1148
  pdfOptions?: JsPdfConfig
@@ -1087,6 +1175,8 @@ export interface JsExtractionConfig {
1087
1175
  cacheTtlSecs?: number
1088
1176
  /** Maximum recursion depth for archive extraction (default: 3) */
1089
1177
  maxArchiveDepth?: number
1178
+ /** Default per-file extraction timeout in seconds */
1179
+ extractionTimeoutSecs?: number
1090
1180
  }
1091
1181
 
1092
1182
  export interface JsExtractionResult {
@@ -1112,6 +1202,8 @@ export interface JsFileExtractionConfig {
1112
1202
  enableQualityProcessing?: boolean
1113
1203
  ocr?: JsOcrConfig
1114
1204
  forceOcr?: boolean
1205
+ /** List of 1-indexed page numbers to force OCR on (None = use force_ocr setting) */
1206
+ forceOcrPages?: Array<number>
1115
1207
  chunking?: JsChunkingConfig
1116
1208
  images?: JsImageExtractionConfig
1117
1209
  pdfOptions?: JsPdfConfig
@@ -1129,6 +1221,8 @@ export interface JsFileExtractionConfig {
1129
1221
  includeDocumentStructure?: boolean
1130
1222
  /** Layout detection configuration (None = layout detection disabled) */
1131
1223
  layout?: JsLayoutDetectionConfig
1224
+ /** Per-file extraction timeout in seconds */
1225
+ timeoutSecs?: number
1132
1226
  }
1133
1227
 
1134
1228
  export interface JsHeadingContext {
@@ -1445,6 +1539,28 @@ export declare function listValidators(): Array<string>
1445
1539
  */
1446
1540
  export declare function loadExtractionConfigFromFile(filePath: string): JsExtractionConfig
1447
1541
 
1542
+ /**
1543
+ * Get the number of pages in a PDF file without rendering.
1544
+ *
1545
+ * # Parameters
1546
+ *
1547
+ * * `file_path` - Path to the PDF file
1548
+ * * `dpi` - Optional DPI (not used for counting, but validates the PDF)
1549
+ *
1550
+ * # Returns
1551
+ *
1552
+ * Number of pages in the PDF.
1553
+ */
1554
+ export declare function pdfPageCount(filePath: string, dpi?: number | undefined | null): number
1555
+
1556
+ /** A rendered PDF page with its zero-based index and PNG data. */
1557
+ export interface PdfPageResult {
1558
+ /** Zero-based page index. */
1559
+ pageIndex: number
1560
+ /** PNG image data. */
1561
+ data: Buffer
1562
+ }
1563
+
1448
1564
  /**
1449
1565
  * Register a custom OCR backend
1450
1566
  *
@@ -1572,6 +1688,38 @@ export declare function registerPostProcessor(processor: object): void
1572
1688
  */
1573
1689
  export declare function registerValidator(validator: object): void
1574
1690
 
1691
+ /**
1692
+ * Render a single page of a PDF file to a PNG buffer (asynchronous).
1693
+ *
1694
+ * Non-blocking alternative to `renderPdfPageSync`.
1695
+ *
1696
+ * # Parameters
1697
+ *
1698
+ * * `file_path` - Path to the PDF file
1699
+ * * `page_index` - Zero-based page index
1700
+ * * `dpi` - Optional DPI (default 150)
1701
+ *
1702
+ * # Returns
1703
+ *
1704
+ * Promise resolving to a Buffer containing PNG image data.
1705
+ */
1706
+ export declare function renderPdfPage(filePath: string, pageIndex: number, dpi?: number | undefined | null): Promise<Buffer>
1707
+
1708
+ /**
1709
+ * Render a single page of a PDF file to a PNG buffer (synchronous).
1710
+ *
1711
+ * # Parameters
1712
+ *
1713
+ * * `file_path` - Path to the PDF file
1714
+ * * `page_index` - Zero-based page index
1715
+ * * `dpi` - Optional DPI (default 150)
1716
+ *
1717
+ * # Returns
1718
+ *
1719
+ * Buffer containing PNG image data.
1720
+ */
1721
+ export declare function renderPdfPageSync(filePath: string, pageIndex: number, dpi?: number | undefined | null): Buffer
1722
+
1575
1723
  /**
1576
1724
  * Unregister a document extractor by name.
1577
1725
  *
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@kreuzberg/node-android-arm64')
79
79
  const bindingPackageVersion = require('@kreuzberg/node-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@kreuzberg/node-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@kreuzberg/node-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@kreuzberg/node-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@kreuzberg/node-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@kreuzberg/node-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@kreuzberg/node-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@kreuzberg/node-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@kreuzberg/node-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@kreuzberg/node-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@kreuzberg/node-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@kreuzberg/node-darwin-universal')
184
184
  const bindingPackageVersion = require('@kreuzberg/node-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@kreuzberg/node-darwin-x64')
200
200
  const bindingPackageVersion = require('@kreuzberg/node-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@kreuzberg/node-darwin-arm64')
216
216
  const bindingPackageVersion = require('@kreuzberg/node-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@kreuzberg/node-freebsd-x64')
236
236
  const bindingPackageVersion = require('@kreuzberg/node-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@kreuzberg/node-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@kreuzberg/node-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@kreuzberg/node-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@kreuzberg/node-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@kreuzberg/node-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@kreuzberg/node-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@kreuzberg/node-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@kreuzberg/node-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@kreuzberg/node-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@kreuzberg/node-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@kreuzberg/node-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@kreuzberg/node-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@kreuzberg/node-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@kreuzberg/node-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@kreuzberg/node-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@kreuzberg/node-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@kreuzberg/node-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@kreuzberg/node-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@kreuzberg/node-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@kreuzberg/node-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@kreuzberg/node-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@kreuzberg/node-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@kreuzberg/node-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@kreuzberg/node-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@kreuzberg/node-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@kreuzberg/node-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@kreuzberg/node-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@kreuzberg/node-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@kreuzberg/node-openharmony-x64')
494
494
  const bindingPackageVersion = require('@kreuzberg/node-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@kreuzberg/node-openharmony-arm')
510
510
  const bindingPackageVersion = require('@kreuzberg/node-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '4.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 4.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '4.6.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 4.6.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -576,6 +576,7 @@ if (!nativeBinding) {
576
576
  }
577
577
 
578
578
  module.exports = nativeBinding
579
+ module.exports.JsPdfPageIterator = nativeBinding.JsPdfPageIterator
579
580
  module.exports.JsWorkerPool = nativeBinding.JsWorkerPool
580
581
  module.exports.batchExtractBytes = nativeBinding.batchExtractBytes
581
582
  module.exports.batchExtractBytesSync = nativeBinding.batchExtractBytesSync
@@ -612,6 +613,8 @@ module.exports.getValidLanguageCodes = nativeBinding.getValidLanguageCodes
612
613
  module.exports.getValidOcrBackends = nativeBinding.getValidOcrBackends
613
614
  module.exports.getValidTokenReductionLevels = nativeBinding.getValidTokenReductionLevels
614
615
  module.exports.getWorkerPoolStats = nativeBinding.getWorkerPoolStats
616
+ module.exports.iteratePdfPages = nativeBinding.iteratePdfPages
617
+ module.exports.iteratePdfPagesSync = nativeBinding.iteratePdfPagesSync
615
618
  module.exports.listDocumentExtractors = nativeBinding.listDocumentExtractors
616
619
  module.exports.listEmbeddingPresets = nativeBinding.listEmbeddingPresets
617
620
  module.exports.listEmbeddingPresets = nativeBinding.listEmbeddingPresets
@@ -619,9 +622,12 @@ module.exports.listOcrBackends = nativeBinding.listOcrBackends
619
622
  module.exports.listPostProcessors = nativeBinding.listPostProcessors
620
623
  module.exports.listValidators = nativeBinding.listValidators
621
624
  module.exports.loadExtractionConfigFromFile = nativeBinding.loadExtractionConfigFromFile
625
+ module.exports.pdfPageCount = nativeBinding.pdfPageCount
622
626
  module.exports.registerOcrBackend = nativeBinding.registerOcrBackend
623
627
  module.exports.registerPostProcessor = nativeBinding.registerPostProcessor
624
628
  module.exports.registerValidator = nativeBinding.registerValidator
629
+ module.exports.renderPdfPage = nativeBinding.renderPdfPage
630
+ module.exports.renderPdfPageSync = nativeBinding.renderPdfPageSync
625
631
  module.exports.unregisterDocumentExtractor = nativeBinding.unregisterDocumentExtractor
626
632
  module.exports.unregisterOcrBackend = nativeBinding.unregisterOcrBackend
627
633
  module.exports.unregisterPostProcessor = nativeBinding.unregisterPostProcessor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kreuzberg/node",
3
- "version": "4.6.0",
3
+ "version": "4.6.3",
4
4
  "description": "Kreuzberg document intelligence - Node.js native bindings",
5
5
  "author": {
6
6
  "name": "Na'aman Hirschfeld",
@@ -90,7 +90,7 @@
90
90
  "build": "napi build --platform --release && tsup",
91
91
  "build:debug": "napi build --platform",
92
92
  "build:ts": "tsup",
93
- "prepare": "tsup",
93
+ "prepare": "tsup || node -e \"var f=require('fs');f.mkdirSync('dist',{recursive:true});f.writeFileSync('dist/cli.js','process.exit(1)')\"",
94
94
  "test": "pnpm test:smoke && pnpm test:binding",
95
95
  "test:smoke": "vitest run tests/smoke/",
96
96
  "test:binding": "vitest run tests/binding/",
@@ -110,21 +110,21 @@
110
110
  "@types/archiver": "^7.0.0",
111
111
  "@types/node": "^25.5.0",
112
112
  "@types/which": "^3.0.4",
113
- "@vitest/coverage-v8": "^4.1.1",
113
+ "@vitest/coverage-v8": "^4.1.2",
114
114
  "archiver": "^7.0.1",
115
115
  "oxlint": "^1.57.0",
116
116
  "tsup": "^8.5.1",
117
117
  "typescript": "^6.0.2",
118
- "vitest": "^4.1.1"
118
+ "vitest": "^4.1.2"
119
119
  },
120
120
  "dependencies": {
121
121
  "@emnapi/runtime": "1.9.1",
122
122
  "which": "^6.0.1"
123
123
  },
124
124
  "optionalDependencies": {
125
- "@kreuzberg/node-darwin-arm64": "4.6.0",
126
- "@kreuzberg/node-linux-arm64-gnu": "4.6.0",
127
- "@kreuzberg/node-linux-x64-gnu": "4.6.0",
128
- "@kreuzberg/node-win32-x64-msvc": "4.6.0"
125
+ "@kreuzberg/node-darwin-arm64": "4.6.3",
126
+ "@kreuzberg/node-linux-arm64-gnu": "4.6.3",
127
+ "@kreuzberg/node-linux-x64-gnu": "4.6.3",
128
+ "@kreuzberg/node-win32-x64-msvc": "4.6.3"
129
129
  }
130
130
  }