npm install tesseract.js
const Tesseract = require('tesseract.js');
const path = require('path');
const imagePath = path.resolve(__dirname, 'path/image');
Tesseract.recognize(
imagePath,
'chi_sim',
{ logger: m => console.log(m) }
).then(({ data: { text } }) => {
console.log('提取到的文本:', text);
}).catch(error => {
console.error('OCR提取失败:', error);
});