Release Scan Tools v0.1.0
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { copyFile, mkdir, rm } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const output = path.join(root, "public", "ocr");
|
||||
await rm(output, { recursive: true, force: true });
|
||||
await mkdir(path.join(output, "core"), { recursive: true });
|
||||
await mkdir(path.join(output, "lang"), { recursive: true });
|
||||
|
||||
await copyFile(
|
||||
path.join(root, "node_modules", "tesseract.js", "dist", "worker.min.js"),
|
||||
path.join(output, "worker.min.js"),
|
||||
);
|
||||
for (const name of [
|
||||
"tesseract-core-lstm.wasm.js",
|
||||
"tesseract-core-simd-lstm.wasm.js",
|
||||
"tesseract-core-relaxedsimd-lstm.wasm.js",
|
||||
])
|
||||
await copyFile(
|
||||
path.join(root, "node_modules", "tesseract.js-core", name),
|
||||
path.join(output, "core", name),
|
||||
);
|
||||
await copyFile(
|
||||
path.join(
|
||||
root,
|
||||
"node_modules",
|
||||
"@tesseract.js-data",
|
||||
"eng",
|
||||
"4.0.0_best_int",
|
||||
"eng.traineddata.gz",
|
||||
),
|
||||
path.join(output, "lang", "eng.traineddata.gz"),
|
||||
);
|
||||
console.log("Prepared same-origin OCR runtime and English model");
|
||||
Reference in New Issue
Block a user