Performance: lazily download ELI when needed instead of bundling this in the download

This commit is contained in:
Pieter Vander Vennet 2024-08-11 16:27:00 +02:00
parent b91b1378d1
commit 62070a64e2
14 changed files with 257 additions and 183 deletions

View file

@ -99,8 +99,17 @@ class DownloadEli extends Script {
const contents =
'{"type":"FeatureCollection",\n "features": [\n' +
keptLayers.map((l) => JSON.stringify(l)).join(",\n") +
keptLayers.filter(l => l.properties.id !== "Bing").map((l) => JSON.stringify(l)).join(",\n") +
"\n]}"
const bing = keptLayers.find(l => l.properties.id === "Bing")
if(bing){
const pth = target.replace(/.json$/, ".bing.json")
fs.writeFileSync(pth, JSON.stringify(bing), { encoding: "utf8" })
console.log("Written", pth)
}else{
console.log("No bing entry found")
}
fs.writeFileSync(target, contents, { encoding: "utf8" })
console.log("Written", keptLayers.length + ", entries to the ELI")
}