const { Linkryse } = require('@linkryse/sdk');
const QRCode = require('qrcode');
const fs = require('fs');
const linkryse = new Linkryse({ apiKey: 'sk_live_...' });
async function generate() {
// 1. Create a Short Link
const link = await linkryse.links.create({
url: 'https://example.com/promotion',
key: 'promo-qrcode'
});
console.log(`Link created: ${link.shortLink}`);
// 2. Generate QR Code
// Linkryse short links automatically support QR code generation by appending ?qr=1
// But here is how to do it manually for custom processing:
await QRCode.toFile('qr.png', link.shortLink);
console.log('QR code saved to qr.png');
}
generate();