@luii/node-tesseract-ocr 2.0.13 → 2.3.2
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/CMakeLists.txt +3 -3
- package/README.md +547 -153
- package/binding-options.js +4 -0
- package/dist/cjs/index.cjs +144 -18
- package/dist/cjs/index.d.ts +6 -859
- package/dist/cjs/types.d.ts +1272 -0
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/utils.d.ts +1 -0
- package/dist/cjs/utils.js +38 -0
- package/dist/esm/index.d.ts +6 -859
- package/dist/esm/index.mjs +129 -14
- package/dist/esm/types.d.ts +1272 -0
- package/dist/esm/types.js +16 -0
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.js +25 -0
- package/package.json +15 -10
- package/prebuilds/node-tesseract-ocr-darwin-arm64/node-napi-v10.node +0 -0
- package/prebuilds/node-tesseract-ocr-linux-x64/node-napi-v10.node +0 -0
- package/src/commands.hpp +656 -88
- package/src/tesseract_wrapper.cpp +643 -187
- package/src/tesseract_wrapper.hpp +27 -4
- package/src/worker_thread.cpp +146 -2
- package/src/worker_thread.hpp +4 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Philipp Czarnetzki
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
13
|
+
* or implied. See the License for the specific language governing
|
|
14
|
+
* permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isValidTraineddata: (filePath: string) => Promise<boolean>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Philipp Czarnetzki
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
13
|
+
* or implied. See the License for the specific language governing
|
|
14
|
+
* permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { stat } from "node:fs/promises";
|
|
17
|
+
export const isValidTraineddata = async (filePath) => {
|
|
18
|
+
try {
|
|
19
|
+
const info = await stat(filePath);
|
|
20
|
+
return info.isFile() && info.size > 0;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luii/node-tesseract-ocr",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"binary": {
|
|
6
6
|
"napi_versions": [
|
|
@@ -47,10 +47,12 @@
|
|
|
47
47
|
"build:ts": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && mkdir -p dist && mv dist/cjs/index.js dist/cjs/index.cjs && mv dist/esm/index.js dist/esm/index.mjs",
|
|
48
48
|
"build:debug": "cmake-js compile --debug && npm run build:ts",
|
|
49
49
|
"build:release": "cmake-js compile --release && npm run build:ts",
|
|
50
|
-
"example:recognize": "npm run build:debug && tsc -p tsconfig.examples.json && node -r dotenv/config dist/examples/recognize.js
|
|
50
|
+
"example:recognize": "npm run build:debug && tsc -p tsconfig.examples.json && DOTENV_CONFIG_PATH=.env.local node -r dotenv/config dist/examples/recognize.js",
|
|
51
|
+
"example:multi-page": "npm run build:debug && tsc -p tsconfig.examples.json && DOTENV_CONFIG_PATH=.env.local node -r dotenv/config dist/examples/multi-page.js",
|
|
51
52
|
"test:cpp": "cmake-js compile --release && ./build/release/node-tesseract-ocr-tests",
|
|
52
53
|
"test:js": "vitest run",
|
|
53
|
-
"test:js:watch": "vitest"
|
|
54
|
+
"test:js:watch": "vitest",
|
|
55
|
+
"test:types": "tsc -p tsconfig.type-tests.json"
|
|
54
56
|
},
|
|
55
57
|
"files": [
|
|
56
58
|
"dist/**",
|
|
@@ -58,20 +60,23 @@
|
|
|
58
60
|
"src/**",
|
|
59
61
|
"build/release/*.node",
|
|
60
62
|
"package.json",
|
|
63
|
+
"binding-options.js",
|
|
61
64
|
"CMakeLists.txt",
|
|
62
65
|
"README.md",
|
|
63
66
|
"LICENSE.md"
|
|
64
67
|
],
|
|
65
68
|
"devDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"@types/node": "^22.0.0",
|
|
68
|
-
"typescript": "^5.6.0"
|
|
69
|
-
},
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"cmake-js": "^7.4.0",
|
|
69
|
+
"cmake-js": "^8.0.0",
|
|
72
70
|
"node-addon-api": "^8.5.0",
|
|
71
|
+
"@types/node": "^25.1.0",
|
|
72
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
73
73
|
"dotenv": "^16.4.5",
|
|
74
|
-
"
|
|
74
|
+
"typescript": "^5.6.0",
|
|
75
|
+
"vitest": "^4.0.18"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"pkg-prebuilds": "^1.0.0",
|
|
79
|
+
"proper-lockfile": "^4.1.2"
|
|
75
80
|
},
|
|
76
81
|
"exports": {
|
|
77
82
|
"require": {
|
|
Binary file
|
|
Binary file
|