Support more languages

This commit is contained in:
2021-09-17 21:35:39 +05:30
parent 2a9675c5b8
commit 21b7ef353a
3 changed files with 21 additions and 6 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = async function (fastify, opts) {
const data = await req.file();
const uid = crypto.randomBytes(16).toString("hex");
const filename = `${UPLOAD_PATH}/${uid}.${mime.extension(data.mimetype)}`;
const lang = "mal+eng";
const lang = req.query.lang ? req.query.lang.replace(/:/g, "+") : "mal";
await pump(data.file, fs.createWriteStream(filename));
const args = [filename, "stdout", "-l", lang];
const { stdout, stderr } = await exec("tesseract", args);