My current code is this:
const fs = require('fs');
var file = fs.readFileSync('file.txt').toString().split("\n");
for(i in file) {
var [thing1, thing2, thing3] = file[i].split(":");
myfunction(thing1, thing2, thing3);
}
This executes a function for each line in the file with some info from the file. For technical reasons, I can only have the function running once at a time. How can I make the for loop wait for the function to complete before looping again?