prelöoad experiment
This commit is contained in:
20
scripts/qr-cert.mjs
Normal file
20
scripts/qr-cert.mjs
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env node
|
||||
/** Print a terminal QR for stdin (or argv[2]) — raw payload only. */
|
||||
import qrcode from 'qrcode';
|
||||
|
||||
const fromArg = process.argv[2];
|
||||
const payload = fromArg
|
||||
? fromArg
|
||||
: (await new Response(process.stdin).text()).trim();
|
||||
|
||||
if (!payload) {
|
||||
console.error('usage: qr-cert.mjs <base64-der> or pipe payload on stdin');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const out = await qrcode.toString(payload, {
|
||||
type: 'terminal',
|
||||
errorCorrectionLevel: 'L',
|
||||
small: true,
|
||||
});
|
||||
process.stdout.write(out);
|
||||
Reference in New Issue
Block a user