forked from austintgriffith/paper-wallet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
batch-austin.js
37 lines (29 loc) · 892 Bytes
/
batch-austin.js
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
36
37
const util = require('util');
const exec = util.promisify(require('child_process').exec);
var merge = require('easy-pdf-merge');
var fs = require('fs')
const HOWMANY = 5
async function generate() {
let sources = []
for(let count=1;count<=HOWMANY;count++){
const { stdout, stderr } = await exec('node index.js');
if (stderr) {
console.error(`error: ${stderr}`);
}
let name = stdout.substring(2,10)
console.log("Generated: "+name);
await exec('mv generated.pdf '+name+'.pdf');
sources[count-1] = (""+name+".pdf")
}
merge(sources,"wallets.pdf",function(err){
if(err)
return console.log(err);
console.log('Success');
var i = sources.length;
sources.forEach(function(filepath){
console.log("Cleaning up "+filepath)
fs.unlinkSync(filepath);
});
});
}
generate()