-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.js
32 lines (27 loc) · 882 Bytes
/
client.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
const puppeteer = require("puppeteer-extra");
puppeteer.use(require("puppeteer-extra-plugin-stealth")());
const fs = require('fs');
const loadFile = require('./loadFile');
const saveFile = require('./saveFile');
const csvToObj = require('./csvToObj.js');
const pageCmd = require('./pageCmd.js');
//console.log(process.argv);
const myArgs = process.argv.slice(2);
//console.log('myArgs: ', myArgs);
// START
(async () => {
for (const filepath_csv of myArgs) {
console.log(filepath_csv);
try {
// read contents of the file
let data = fs.readFileSync(filepath_csv, 'UTF-8');
let command_obj = await csvToObj(data);
//console.log(command_obj);
await pageCmd(command_obj);
} catch (err) {
console.error(err);
process.exit(1);
}
}
//process.exit(1);
})();