aws-lambda-tesseract icon indicating copy to clipboard operation
aws-lambda-tesseract copied to clipboard

Set output types

Open devdras opened this issue 2 years ago • 1 comments

Hi, can you add the option for output types please? Could look something like this: `async function getTextFromImage(filePath, outputType) { await (0, _tar.extract)({ file: inputPath, cwd: '/tmp' });

if (outputType !== 'stdout' || outputType !== 'txt' || outputType !== 'pdf'|| outputType !== 'hocr'|| outputType !== 'tsv') { return "BAD_OUTPUT_TYPE" }

const stdout = (0, _child_process.execFileSync)(outputPath, [filePath, outputType, '-l', 'eng'], { cwd: '/tmp/tesseract-standalone', env: { LD_LIBRARY_PATH: './lib', TESSDATA_PREFIX: './tessdata' } }); (0, _child_process.execSync)(rm ${filePath}); return stdout.toString(); }`

devdras avatar Sep 21 '22 20:09 devdras

PRs are welcome!

vladholubiev avatar Sep 29 '22 17:09 vladholubiev