node-native-win-utils 1.3.3 → 1.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/LICENSE +1 -1
- package/README.md +3 -6
- package/binding.gyp +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -4
- package/dllCopy.js +14 -0
- package/include/tesseract/baseapi.h +820 -0
- package/include/tesseract/capi.h +485 -0
- package/include/tesseract/export.h +37 -0
- package/include/tesseract/ltrresultiterator.h +235 -0
- package/include/tesseract/ocrclass.h +158 -0
- package/include/tesseract/osdetect.h +139 -0
- package/include/tesseract/pageiterator.h +364 -0
- package/include/tesseract/publictypes.h +281 -0
- package/include/tesseract/renderer.h +334 -0
- package/include/tesseract/resultiterator.h +250 -0
- package/include/tesseract/tesseract.h +40 -0
- package/include/tesseract/unichar.h +174 -0
- package/include/tesseract/version.h +34 -0
- package/include/tesseract/version.h.in +34 -0
- package/libs/tesseract.lib +0 -0
- package/package.json +9 -6
- package/prebuilds/win32-x64/node-native-win-utils.node +0 -0
- package/prebuilds/win32-x64/tesseract.dll +0 -0
- package/prebuilds/win32-x64/tiff.dll +0 -0
- package/src/cpp/main.cpp +2 -0
- package/src/cpp/tesseract.cpp +49 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
[![License][license-src]][license-href]
|
|
3
|
-
|
|
4
|
-
[](https://www.buymeacoffee.com/ryner)
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+

|
|
7
4
|
|
|
8
5
|
#### USDT TRC20 - TYAJ3K3MZraJhWimxxeCKcJ2SYABkVsrzi
|
|
9
6
|
#### USDT TON - UQDokuYZXr4OHvfslDqUoFYcp1_F8tcjQPk_TvqSSDk7SIa7
|
|
@@ -750,9 +747,9 @@ console.log("Key up:", data.keyCode, data.keyName);
|
|
|
750
747
|
|
|
751
748
|
|
|
752
749
|
[OpenCV License](https://github.com/opencv/opencv/blob/master/LICENSE)
|
|
753
|
-
[MIT License](https://github.com/
|
|
750
|
+
[MIT License](https://github.com/T-Rumibul/node-native-win-utils/blob/main/LICENSE)
|
|
754
751
|
|
|
755
752
|
|
|
756
753
|
[license-src]: https://img.shields.io/github/license/nuxt-modules/icon.svg?style=for-the-badge&colorA=18181B&colorB=28CF8D
|
|
757
754
|
|
|
758
|
-
[license-href]: https://github.com/
|
|
755
|
+
[license-href]: https://github.com/T-Rumibul/node-native-win-utils/blob/main/LICENSE
|
package/binding.gyp
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"<!(node -p \"require('path').resolve('libs/opencv_core470.lib')\")",
|
|
24
24
|
"<!(node -p \"require('path').resolve('libs/opencv_imgcodecs470.lib')\")",
|
|
25
25
|
"<!(node -p \"require('path').resolve('libs/opencv_imgproc470.lib')\")",
|
|
26
|
+
"<!(node -p \"require('path').resolve('libs/tesseract.lib')\")",
|
|
26
27
|
|
|
27
28
|
],
|
|
28
29
|
"conditions": [
|
package/dist/index.d.ts
CHANGED
|
@@ -80,7 +80,8 @@ export type Blur = (image: ImageData, sizeX: number, sizeY: number) => ImageData
|
|
|
80
80
|
export type BgrToGray = (image: ImageData) => ImageData;
|
|
81
81
|
export type DrawRectangle = (image: ImageData, start: Point, end: Point, rgb: Color, thickness: number) => ImageData;
|
|
82
82
|
export type GetRegion = (image: ImageData, region: ROI) => ImageData;
|
|
83
|
-
|
|
83
|
+
export type TextRecognition = (trainedDataPath: string, dataLang: string, imagePath: string) => string;
|
|
84
|
+
declare const keyDownHandler: KeyDownHandler, keyUpHandler: KeyUpHandler, getWindowData: GetWindowData, captureWindowN: CaptureWindow, mouseMove: MouseMove, mouseClick: MouseClick, mouseDrag: MouseDrag, typeString: TypeString, textRecognition: TextRecognition;
|
|
84
85
|
declare const rawPressKey: PressKey;
|
|
85
86
|
/**
|
|
86
87
|
* Captures a window and saves it to a file.
|
|
@@ -175,4 +176,4 @@ export declare class OpenCV {
|
|
|
175
176
|
imwrite(path: string): void;
|
|
176
177
|
}
|
|
177
178
|
declare function keyPress(keyCode: number, repeat?: number): Promise<boolean>;
|
|
178
|
-
export { keyDownHandler, keyUpHandler, getWindowData, captureWindow, captureWindowN, mouseMove, mouseClick, mouseDrag, typeString, keyPress, rawPressKey, KeyCodeHelper };
|
|
179
|
+
export { keyDownHandler, keyUpHandler, getWindowData, captureWindow, captureWindowN, mouseMove, mouseClick, mouseDrag, typeString, keyPress, rawPressKey, KeyCodeHelper, textRecognition };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.KeyCodeHelper = exports.rawPressKey = exports.typeString = exports.mouseDrag = exports.mouseClick = exports.mouseMove = exports.captureWindowN = exports.getWindowData = exports.keyUpHandler = exports.keyDownHandler = exports.OpenCV = exports.KeyListener = void 0;
|
|
6
|
+
exports.textRecognition = exports.KeyCodeHelper = exports.rawPressKey = exports.typeString = exports.mouseDrag = exports.mouseClick = exports.mouseMove = exports.captureWindowN = exports.getWindowData = exports.keyUpHandler = exports.keyDownHandler = exports.OpenCV = exports.KeyListener = void 0;
|
|
7
7
|
exports.captureWindow = captureWindow;
|
|
8
8
|
exports.keyPress = keyPress;
|
|
9
9
|
const EventEmitter = require("events");
|
|
@@ -12,7 +12,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
12
12
|
const bindings = require("node-gyp-build")(path_1.default.resolve(__dirname, ".."));
|
|
13
13
|
const keyCodes_1 = require("./keyCodes");
|
|
14
14
|
Object.defineProperty(exports, "KeyCodeHelper", { enumerable: true, get: function () { return keyCodes_1.KeyCodeHelper; } });
|
|
15
|
-
const { keyDownHandler, keyUpHandler, getWindowData, captureWindowN, mouseMove, mouseClick, mouseDrag, typeString, pressKey, imread, imwrite, matchTemplate, blur, bgrToGray, drawRectangle, getRegion, } = bindings;
|
|
15
|
+
const { keyDownHandler, keyUpHandler, getWindowData, captureWindowN, mouseMove, mouseClick, mouseDrag, typeString, pressKey, imread, imwrite, matchTemplate, blur, bgrToGray, drawRectangle, getRegion, textRecognition } = bindings;
|
|
16
16
|
exports.keyDownHandler = keyDownHandler;
|
|
17
17
|
exports.keyUpHandler = keyUpHandler;
|
|
18
18
|
exports.getWindowData = getWindowData;
|
|
@@ -21,6 +21,7 @@ exports.mouseMove = mouseMove;
|
|
|
21
21
|
exports.mouseClick = mouseClick;
|
|
22
22
|
exports.mouseDrag = mouseDrag;
|
|
23
23
|
exports.typeString = typeString;
|
|
24
|
+
exports.textRecognition = textRecognition;
|
|
24
25
|
const rawPressKey = pressKey;
|
|
25
26
|
exports.rawPressKey = rawPressKey;
|
|
26
27
|
/**
|
|
@@ -33,7 +34,7 @@ function captureWindow(windowName, path) {
|
|
|
33
34
|
const buffer = captureWindowN(windowName);
|
|
34
35
|
if (!buffer)
|
|
35
36
|
return false;
|
|
36
|
-
fs_1.default.writeFileSync(path, buffer);
|
|
37
|
+
fs_1.default.writeFileSync(path, new Uint8Array(buffer));
|
|
37
38
|
return true;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
@@ -141,7 +142,7 @@ class OpenCV {
|
|
|
141
142
|
const buffer = imwrite(this.imageData);
|
|
142
143
|
if (!buffer)
|
|
143
144
|
return;
|
|
144
|
-
fs_1.default.writeFileSync(path, buffer);
|
|
145
|
+
fs_1.default.writeFileSync(path, new Uint8Array(buffer));
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
exports.OpenCV = OpenCV;
|
package/dllCopy.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { cp } = require('fs').promises;
|
|
2
|
+
|
|
3
|
+
async function copyDlls() {
|
|
4
|
+
try {
|
|
5
|
+
// Copy a directory recursively
|
|
6
|
+
await cp('./dll', './prebuilds\\win32-x64', { recursive: true });
|
|
7
|
+
console.log('Dlls copied to prebuilds location');
|
|
8
|
+
} catch (err) {
|
|
9
|
+
console.error('Error:', err.message);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
copyDlls()
|