@luii/node-tesseract-ocr 2.1.0 → 2.4.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.
- 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 +1283 -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 +1283 -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 +688 -88
- package/src/tesseract_wrapper.cpp +652 -187
- package/src/tesseract_wrapper.hpp +27 -2
- package/src/worker_thread.cpp +146 -2
- package/src/worker_thread.hpp +4 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
* or implied. See the License for the specific language governing
|
|
14
14
|
* permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { existsSync, createWriteStream } from "node:fs";
|
|
17
|
+
import { mkdir, rename, rm, copyFile } from "node:fs/promises";
|
|
18
|
+
import os from "node:os";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { Readable, Transform } from "node:stream";
|
|
21
|
+
import { pipeline } from "node:stream/promises";
|
|
22
|
+
import { createGunzip } from "node:zlib";
|
|
23
|
+
import { lock } from "proper-lockfile";
|
|
24
|
+
import { isValidTraineddata } from "./utils";
|
|
16
25
|
/**
|
|
17
26
|
* All available languages for tesseract
|
|
18
27
|
* @readonly
|
|
@@ -227,15 +236,6 @@ export const LogLevels = {
|
|
|
227
236
|
FATAL: "50000",
|
|
228
237
|
OFF: "2147483647",
|
|
229
238
|
};
|
|
230
|
-
import { existsSync, createWriteStream } from "node:fs";
|
|
231
|
-
import { mkdir, rename, rm, copyFile } from "node:fs/promises";
|
|
232
|
-
import os from "node:os";
|
|
233
|
-
import path from "node:path";
|
|
234
|
-
import { Readable, Transform } from "node:stream";
|
|
235
|
-
import { pipeline } from "node:stream/promises";
|
|
236
|
-
import { createGunzip } from "node:zlib";
|
|
237
|
-
import { lock } from "proper-lockfile";
|
|
238
|
-
import { isValidTraineddata } from "./utils";
|
|
239
239
|
const TESSDATA4_BEST = (lang) => `https://cdn.jsdelivr.net/npm/@tesseract.js-data/${lang}/4.0.0_best_int/`;
|
|
240
240
|
const TESSDATA4 = (lang) => `https://cdn.jsdelivr.net/npm/@tesseract.js-data/${lang}/4.0.0/`;
|
|
241
241
|
const DEFAULT_CACHE_DIR = path.join(os.homedir(), ".cache", "node-tesseract-ocr", "tessdata");
|
|
@@ -249,6 +249,13 @@ const prebuildRoot = existsSync(bindingOptionsFromSource)
|
|
|
249
249
|
: process.cwd();
|
|
250
250
|
const { Tesseract: NativeTesseract } = require("pkg-prebuilds")(prebuildRoot, require(bindingOptionsPath));
|
|
251
251
|
class Tesseract extends NativeTesseract {
|
|
252
|
+
document = {
|
|
253
|
+
begin: this.beginProcessPages.bind(this),
|
|
254
|
+
addPage: this.addProcessPage.bind(this),
|
|
255
|
+
finish: this.finishProcessPages.bind(this),
|
|
256
|
+
abort: this.abortProcessPages.bind(this),
|
|
257
|
+
status: this.getProcessPagesStatus.bind(this),
|
|
258
|
+
};
|
|
252
259
|
constructor() {
|
|
253
260
|
super();
|
|
254
261
|
}
|