How to known Tesseract has terminated the job in order to start next function? It's running as an async function but i need to start next function when OCR is done. I tried to start when OCR string is not empty but my next function starts before. Should i use "Promise" option ? If yes, how? Here, Tesseract basic example used:
const { createWorker } = require('tesseract.js');
const worker = createWorker();
(async () => {
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const { data: { text } } = await
worker.recognize('myimage.png');
console.log(text);
await worker.terminate();
})();