I have been looking through promise questions for the last hour and am totally clueless so I decided to write a question as I am unable to store the value of the function in a variable without it resulting in a promise.
const T = require("tesseract.js");
async function imageCheck(T, url){
T.recognize(url, 'eng')
.then(out => {return(out.data.text)});
}
url = imageCheck(T, 'EXAMPLEURL');
Promise.resolve(url)
console.log("the url is "+url)
My output is:
the url is [object Promise]
The
Promise.resolve()will return anotherPromise. You should usethento get value.MDN Documentation
I would recommend the following ways.
OR