forked from austintgriffith/paper-wallet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evgeni
committed
Apr 28, 2019
1 parent
49f5847
commit e762b98
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ addresses.txt | |
node_modules | ||
generated* | ||
*.svg | ||
wallets* | ||
wallets* | ||
pricelist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const qr = require('qr-image'); | ||
const csv = require('csv-parser'); | ||
const fs = require('fs'); | ||
|
||
const URL = "https://sundai.io" | ||
const priceList = 'pricelist-ws.csv'; | ||
const folder = 'pricelist'; | ||
const workDir = process.cwd(); | ||
|
||
async function run() { | ||
const prices = []; | ||
|
||
fs.createReadStream(`${workDir}/${folder}/${priceList}`) | ||
.pipe(csv()) | ||
.on('data', (row) => { | ||
prices.push(row); | ||
}) | ||
.on('end', async () => { | ||
console.log(prices); | ||
let priceLink; | ||
let address; | ||
let price; | ||
let item; | ||
let event; | ||
let priceQR; | ||
for(let i = 0; i < prices.length; i++) { | ||
event = prices[i].event; | ||
address = prices[i].address; | ||
price = prices[i].price; | ||
item = prices[i].item; | ||
priceLink = `${URL}/${address};${price};${item}`; | ||
priceQR = qr.image(priceLink, { type: 'png' }); | ||
priceQR.pipe(require('fs').createWriteStream(`${folder}/${event}_${address.substring(0,8)}_${item}.png`)); | ||
} | ||
}); | ||
} | ||
|
||
run(); | ||
|
||
|
||
|