Download logging tweaks

This commit is contained in:
Mashintime 2023-07-29 09:49:09 -04:00
parent 0f1ab97444
commit 7332b6d1b3

View file

@ -1055,13 +1055,14 @@ function downloadJsonUrlToFile(url, callsignPath) {
https https
.get(url, (res) => { .get(url, (res) => {
console.log("statusCode:", res.statusCode); //console.log("statusCode:", res.statusCode);
console.log("headers:", res.headers); //console.log("headers:", res.headers);
res.on("data", (d) => { res.on("data", (d) => {
console.log(d); //console.log(d);
let json = JSON.parse(d); let json = JSON.parse(d);
fs.writeFileSync(callsignPath, JSON.stringify(json, null, 2)); fs.writeFileSync(callsignPath, JSON.stringify(json, null, 2));
sysInfo.info("Download " + url +" return statuscode: " + res.statusCode);
}); });
}) })
.on("error", (e) => { .on("error", (e) => {
@ -1069,6 +1070,7 @@ function downloadJsonUrlToFile(url, callsignPath) {
}); });
} }
function downloadCallsignReverseLookupData() { function downloadCallsignReverseLookupData() {
sysInfo.info("Downloading callsigns.json");
var callsignPath = path.join(configFolder, "callsigns.json"); var callsignPath = path.join(configFolder, "callsigns.json");
downloadJsonUrlToFile( downloadJsonUrlToFile(
"https://api.freedata.app/callsign_lookup.php", "https://api.freedata.app/callsign_lookup.php",