diff --git a/examples/node/benchmark.js b/examples/node/benchmark.js index 728d1d5..28d3fe7 100644 --- a/examples/node/benchmark.js +++ b/examples/node/benchmark.js @@ -2,10 +2,8 @@ const path = require('path'); const { createWorker } = require('../../'); -const worker = createWorker(); - (async () => { - await worker.load(); + const worker = await createWorker(); await worker.loadLanguage('eng'); await worker.initialize('eng'); const fileArr = ["../data/meditations.jpg", "../data/tyger.jpg", "../data/testocr.png"]; diff --git a/examples/node/download-pdf.js b/examples/node/download-pdf.js index f61e55c..2f7ed24 100755 --- a/examples/node/download-pdf.js +++ b/examples/node/download-pdf.js @@ -9,8 +9,7 @@ const image = path.resolve(__dirname, (imagePath || '../../tests/assets/images/c console.log(`Recognizing ${image}`); (async () => { - const worker = createWorker(); - await worker.load(); + const worker = await createWorker(); await worker.loadLanguage('eng'); await worker.initialize('eng'); const { data: { text } } = await worker.recognize(image); diff --git a/examples/node/recognize.js b/examples/node/recognize.js index c77955e..082ffa0 100755 --- a/examples/node/recognize.js +++ b/examples/node/recognize.js @@ -6,12 +6,11 @@ const [,, imagePath] = process.argv; const image = path.resolve(__dirname, (imagePath || '../../tests/assets/images/cosmic.png')); console.log(`Recognizing ${image}`); -const worker = createWorker({ - logger: m => console.log(m), -}); (async () => { - await worker.load(); + const worker = await createWorker({ + logger: m => console.log(m), + }); await worker.loadLanguage('eng'); await worker.initialize('eng'); const { data: { text } } = await worker.recognize(image);