I have the following code:
readInterface.on('line', async (line) => {
const splitLine = line.split(',')
const domain = splitLine[0]
splitLine.shift()
const query = `INSERT INTO domains (domain, ips) VALUES(?, ?);`;
try {
await client.execute(query, [ domain, splitLine ])
} catch(e) {
console.log(e)
}
});
Currently this doesn't work. The code doesn't await before moving on to the next line. How can I change this to await the execute for each query keeping in mind the file is too big for node and cannot be read into memory?