-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (30 loc) · 783 Bytes
/
index.js
File metadata and controls
35 lines (30 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ESNext Modules
require('babel-polyfill');
const brandedQRCode = require('branded-qr-code');
const path = require('path');
const fs = require('fs');
run().catch(error => console.error(error.stack));
// Return a buffer with the PNG of the code
async function run() {
const logoPath = path.resolve(__dirname, './logo/wapuu-qr.png'); // Add logo here.
const url = ''; // Add your URL here.
const res = await brandedQRCode.generate(
{
text: url,
path: logoPath,
ratio: 3,
opt: {
errorCorrectionLevel: 'H',
margin: 1,
width: 512,
scale: 6
}
}
);
fs.writeFile('output/qr-code.png', res, (err) => {
if(err) {
return console.log(err);
}
console.log('File saved successfully!');
});
}