feat: works better
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
import { instantiate } from "./lib/rs_lib.generated.js";
|
||||
|
||||
const { decode_qr } = await instantiate();
|
||||
|
||||
const bytes = await Deno.readFile("test_qr_3.png");
|
||||
async function main() {
|
||||
if (Deno.args.length == 0) {
|
||||
console.error('No arguments assigned!');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Input files: ', Deno.args);
|
||||
for (let i = 0; i < Deno.args.length; i++) {
|
||||
let arg = Deno.args[i];
|
||||
console.log("----- Processing file: ", arg, '-----');
|
||||
try {
|
||||
let bytes = await Deno.readFile(arg);
|
||||
let qr_json = decode_qr(bytes);
|
||||
const parsed_qr = await JSON.parse(qr_json);
|
||||
console.log(JSON.stringify(parsed_qr, null, 4));
|
||||
} catch (e) {
|
||||
console.error('Process file: ', arg, ' failed: ', e + '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(decode_qr(bytes));
|
||||
await main();
|
||||
|
||||
Reference in New Issue
Block a user