@luii/node-tesseract-ocr 2.1.0 → 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 +461 -104
- package/binding-options.js +4 -0
- package/dist/cjs/index.cjs +21 -9
- package/dist/cjs/index.d.ts +4 -926
- package/dist/cjs/types.d.ts +1272 -0
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/utils.js +15 -0
- package/dist/esm/index.d.ts +4 -926
- package/dist/esm/index.mjs +16 -9
- package/dist/esm/types.d.ts +1272 -0
- package/dist/esm/types.js +16 -0
- package/dist/esm/utils.js +15 -0
- package/package.json +6 -3
- 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 +657 -88
- package/src/tesseract_wrapper.cpp +630 -187
- package/src/tesseract_wrapper.hpp +27 -2
- package/src/worker_thread.cpp +146 -2
- package/src/worker_thread.hpp +4 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -28,6 +28,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.NativeTesseract = exports.Tesseract = exports.LogLevels = exports.PageSegmentationModes = exports.OcrEngineModes = exports.Language = void 0;
|
|
31
|
+
const node_fs_1 = require("node:fs");
|
|
32
|
+
const promises_1 = require("node:fs/promises");
|
|
33
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
34
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
35
|
+
const node_stream_1 = require("node:stream");
|
|
36
|
+
const promises_2 = require("node:stream/promises");
|
|
37
|
+
const node_zlib_1 = require("node:zlib");
|
|
38
|
+
const proper_lockfile_1 = require("proper-lockfile");
|
|
39
|
+
const utils_1 = require("./utils");
|
|
31
40
|
/**
|
|
32
41
|
* All available languages for tesseract
|
|
33
42
|
* @readonly
|
|
@@ -242,15 +251,6 @@ exports.LogLevels = {
|
|
|
242
251
|
FATAL: "50000",
|
|
243
252
|
OFF: "2147483647",
|
|
244
253
|
};
|
|
245
|
-
const node_fs_1 = require("node:fs");
|
|
246
|
-
const promises_1 = require("node:fs/promises");
|
|
247
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
248
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
249
|
-
const node_stream_1 = require("node:stream");
|
|
250
|
-
const promises_2 = require("node:stream/promises");
|
|
251
|
-
const node_zlib_1 = require("node:zlib");
|
|
252
|
-
const proper_lockfile_1 = require("proper-lockfile");
|
|
253
|
-
const utils_1 = require("./utils");
|
|
254
254
|
const TESSDATA4_BEST = (lang) => `https://cdn.jsdelivr.net/npm/@tesseract.js-data/${lang}/4.0.0_best_int/`;
|
|
255
255
|
const TESSDATA4 = (lang) => `https://cdn.jsdelivr.net/npm/@tesseract.js-data/${lang}/4.0.0/`;
|
|
256
256
|
const DEFAULT_CACHE_DIR = node_path_1.default.join(node_os_1.default.homedir(), ".cache", "node-tesseract-ocr", "tessdata");
|
|
@@ -267,6 +267,18 @@ exports.NativeTesseract = NativeTesseract;
|
|
|
267
267
|
class Tesseract extends NativeTesseract {
|
|
268
268
|
constructor() {
|
|
269
269
|
super();
|
|
270
|
+
Object.defineProperty(this, "document", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
configurable: true,
|
|
273
|
+
writable: true,
|
|
274
|
+
value: {
|
|
275
|
+
begin: this.beginProcessPages.bind(this),
|
|
276
|
+
addPage: this.addProcessPage.bind(this),
|
|
277
|
+
finish: this.finishProcessPages.bind(this),
|
|
278
|
+
abort: this.abortProcessPages.bind(this),
|
|
279
|
+
status: this.getProcessPagesStatus.bind(this),
|
|
280
|
+
}
|
|
281
|
+
});
|
|
270
282
|
}
|
|
271
283
|
init() {
|
|
272
284
|
const _super = Object.create(null, {
|