https://medium.com/swlh/understanding-nodejs-worker-thread-6212b95a0928
Worker threads are an exciting and useful module if you need to do CPU-intensive tasks in your Node.js application. It’s like threads without shared memory and, thus, without the potential race conditions they introduce. Since the worker_threads module became stable in Node.js v12 LTS, you should feel secure using it in production-grade apps!
https://apple.stackexchange.com/questions/96368/playing-alert-sounds-from-terminal
https://jeromewus.medium.com/why-i-refactor-tesseract-js-v2-50f750a9cfe2
https://github.com/naptha/tesseract.js/issues/340
var worker =
window.OCRWorker ||
new Tesseract.TesseractWorker({
workerPath: workerPath,
langPath: langPath,
corePath: corePath
});
window.OCRWorker = worker;
worker.recognize(image, 'eng', options).then(onSuccess);
[3, 10, 20].forEach(num => (
it(`recognize ${num} images with 1 worker`, (done) => {
const worker = getWorker();
Promise.all(
Array(num).fill(0).map(() => worker.recognize(`${IMAGE_PATH}/simple.png`)),
).then((results) => {
results.forEach(({ text }) => {
expect(text).to.be(SIMPLE_TEXT);
});
worker.terminate();
done();
});
}).timeout(60000)
));
});
https://www.smashingmagazine.com/2021/06/image-text-conversion-react-tesseract-js-ocr/
Comments
Post a Comment