Skip to content
1 min read · 166 words

@nhtio/adk/batteries/media/engines/tesseract_js

A cross-environment OCR @nhtio/adk/batteries/media/contracts!MediaEngine backed by tesseract.js (WASM Tesseract — Node and browsers, no binary).

Remarks

The local-by-default OCR engine. Language data files download on first use of each language; point langPath/cachePath at a writable location to control where (the factory requires languages up front so a deployment never silently fetches packs for languages it didn't plan for). Workers are created per recognize call and terminated in finally — slower than a pooled setup but leak-free by construction; consumers who need pooling can BYO an engine that holds a worker.

tesseract.js is an optional peer dependency, lazily imported on first actual use.

Declares one convert capability: image/* to txt/hocr/json (OCR is a format conversion — image in, text out). Language hints ride request.options.languages.

Interfaces

InterfaceDescription
TesseractJsEngineOptionsOptions for tesseractJsEngine.

Functions

FunctionDescription
tesseractJsEngineConstruct the tesseract.js OCR engine.