Hi so I have this piece of code that I want to run in order, however I always end up running the last line first and then the first one. Some guidance with this would be great.
await fs.readFile(file, "UTF-8", (err, lines) => {
lines = lines.split(/\r?\n/);
lines.forEach( (line) => {
line = line.split('\t');
let book = new Book(line[0], line[1], line[2], line[3],
line[4],line[5],line[6],line[7],line[8],line[9],
line[10],line[11]);
console.log(book);
}
);
});
await pgdb.closeDatabase();
Close database looks like this
closeDatabase = async() => {
console.log("Closed")
this.client.end();
}
Thanks!