zapolnoch / node-tesseract-ocr

A Node.js wrapper for the Tesseract OCR API
MIT License
304 stars 38 forks source link

Fix ERR_CHILD_PROCESS_STDIO_MAXBUFFER #41

Open Lambdac0re opened 2 years ago

Lambdac0re commented 2 years ago

The followin error occurs, when tesseract produces more stderr output than the default nodejs maxBuffer.

uncaughtException RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded

Here I just increase the value by 4x the default and tesseract runs fine again.

EHadoux commented 2 years ago

Yeah, I need that as well especially with hocr that is quite chatty. However, perhaps making it customisable would be better than a fixed value. Also, wider point, it's probably better to use spawn rather than exec, see https://www.hacksparrow.com/nodejs/difference-between-spawn-and-exec-of-node-js-child-rocess.html for instance.

Lambdac0re commented 2 years ago

That is true, but let's start with this first.