aws-lambda-tesseract
aws-lambda-tesseract copied to clipboard
Set output types
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();
}`
PRs are welcome!