bajar todos los feeds al mismo tiempo

This commit is contained in:
Cat /dev/Nulo 2023-07-17 16:33:40 -03:00
parent 1a0f50093b
commit 58181255b2

View file

@ -10,12 +10,14 @@ export const feeds = {
};
if (process.argv[2] === "refresh") {
for (const [name, url] of Object.entries(feeds)) {
console.log(`Refreshing ${name}`);
const res = await fetch(url);
const txt = await res.text();
await writeFile(join("cached-feeds/", `${name}.xml`), txt);
}
await Promise.all(
Object.entries(feeds).map(async ([name, url]) => {
console.log(`Refreshing ${name}`);
const res = await fetch(url);
const txt = await res.text();
await writeFile(join("cached-feeds/", `${name}.xml`), txt);
})
);
}
/**