Browser
The same grader runs in a browser; nothing is uploaded. The demo is built on this entry point, and its source is in demo/.
js
import { configure, gradeBytes } from "barcode-grader/browser";
configure({ pdfWorkerSrc: "/pdf.worker.min.mjs", zxingWasmUrl: "/zxing_reader.wasm" });
const report = await gradeBytes(new Uint8Array(await file.arrayBuffer()));Serve two files from your own origin: pdf.js's worker (pdfjs-dist/build/pdf.worker.min.mjs) and ZXing's WebAssembly (zxing-wasm/reader/zxing_reader.wasm). With Vite, import them with ?url.
openPreview(bytes) returns a drawer for the artwork (size(page), draw(page, { maxPx, region }), close()), so you can show each page with the codes boxed on it, as the demo does.
Grading runs on the calling thread. For large files, call it from a worker.