Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

502
Views
worker.recognize(...).progress is not a function. How to fix?

my code is:


    //Imports
    const express = require('express');
    const app = express();
    const fs = require("fs");
    const multer = require('multer');
    const { createWorker } = require("tesseract.js");
    const worker = createWorker();

    //Storage
    const storage = multer.diskStorage({
    destination: (req,file,cb) => {
        cb(null, "./uploads");
    },
    filename: (req,file,cb) => {
        cb(null, file.originalname);
    }
    });
    const upload = multer({storage: storage}).single("avatar");

    app.set('view engine', 'ejs');

    //route
    app.get('/',(req,res)=>{
       res.render('index');
    });

    app.post('/upload',(req,res) => {
        upload(req,res, err => {
            fs.readFile(`./uploads/${req.file.originalname}`,(err,data) => {
                if(err) return console.log('This is your error',err);

             worker
                .recognize(data, "eng", {tessjs_create_pdf: '1'})
                .progress(progress => {
                    console.log(progress);
                })
                .then(result => {
                    res.send(result.text);
                })
                .finally(() => worker.terminate())
             });
         });
     });

     //Start Up our server
     const PORT = 5000 || process.env.PORT;
     app.listen(PORT, () => console.log(`Hey I am running on port ${PORT}`));

the error I get is this

     D:\ML\OCR\app.js:34
                    .progress(progress => {
                     ^

    TypeError: worker.recognize(...).progress is not a function
        at D:\ML\OCR\app.js:34:18

I know worker.recognize/.progress is decapitated but can someone please correct this code. Thank you.

I am trying to create an OCR using tesseract.js . watching this video: https://www.youtube.com/watch?v=a1I3tcALTlc

But I am not able to find a solution.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!