index.js (500B)
1 const { appendFile, extractIdAndUpload, readFile } = require("./helperFns.js"); 2 const { dataFile, errFile, statusFile } = require("./utils.js"); 3 4 async function main() { 5 try { 6 const CSVData = await readFile(dataFile, { encoding: "utf8" }); 7 const CSVLines = CSVData.split("\n"); 8 CSVLines.forEach(async line => await extractIdAndUpload(line)); 9 } catch (err) { 10 const errStr = err.toString(); 11 const content = errStr + "\n"; 12 await appendFile(errFile, content); 13 } 14 } 15 16 main();