diff --git a/lib/tesseract.js b/lib/tesseract.js index 2f7e13c..2aa5537 100644 --- a/lib/tesseract.js +++ b/lib/tesseract.js @@ -63,7 +63,7 @@ var Tesseract = { } if (options.psm !== null) { - command.push('-psm ' + options.psm); + command.push('--psm ' + options.psm); } if (options.config !== null) { @@ -83,7 +83,7 @@ var Tesseract = { } // Find one of the three possible extension - glob(output + '.+(html|hocr|txt)', function(err, files){ + glob(output + '.+(html|hocr|txt)', function(err, files) { if (err) { callback(err, null); return; @@ -97,7 +97,12 @@ var Tesseract = { var index = Tesseract.tmpFiles.indexOf(output); if (~index) Tesseract.tmpFiles.splice(index, 1); - fs.unlinkSync(files[0]); + fs.unlink(files[0], (err) => { + if (err) { + callback(err, null); + return; + } + }); callback(null, data) }); @@ -138,4 +143,4 @@ process.addListener('exit', function _exit(code) { /** * Module exports. */ -module.exports.process = Tesseract.process; +module.exports.process = Tesseract.process; \ No newline at end of file