git ssb

0+

cel-desktop / ssb-pkg



Tree: ca90b5ca0579ebdcc0635288bce4978e3fb200f5

Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-79-npm / tesseract.js / tesseract.js.js

590 bytesRaw
1'use strict';
2
3var fs = require('fs');
4var path = require('path');
5var Tesseract = require('tesseract.js');
6var image = path.join(__dirname, 'hello.jpg');
7
8Tesseract.recognize(image).then(function (data) {
9 if (data && data.text && typeof data.text === 'string') {
10 if (data.text.toLowerCase().indexOf('hello') >= 0) {
11 console.log('ok');
12 } else {
13 console.log(data.text.replace(/\n/g, '\\n'));
14 }
15 } else {
16 console.log(data);
17 }
18}).catch(function (error) {
19 console.log(error);
20}).finally(function () {
21 fs.unlinkSync('eng.traineddata');
22 process.exit();
23});
24

Built with git-ssb-web