-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
22 lines (20 loc) · 831 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const path = require('path');
const MrzScanner = require('./index');
console.log(MrzScanner.getVersionNumber());
MrzScanner.initLicense('DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==');
var obj = new MrzScanner();
var ret = obj.loadModel(path.dirname(require.resolve('./index')));
(async function () {
try {
var result = await obj.decodeFileAsync('images/1.png');
console.log(result);
if (result.length == 2) {
console.log(obj.parseTwoLines(result[0].text, result[1].text));
}
else if (result.length == 3) {
console.log(obj.parseThreeLines(result[0].text, result[1].text, result[2].text));
}
} catch (error) {
console.log(error);
}
})();