bajar todos los feeds al mismo tiempo
This commit is contained in:
parent
1a0f50093b
commit
58181255b2
1 changed files with 8 additions and 6 deletions
14
feeds.js
14
feeds.js
|
@ -10,12 +10,14 @@ export const feeds = {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.argv[2] === "refresh") {
|
if (process.argv[2] === "refresh") {
|
||||||
for (const [name, url] of Object.entries(feeds)) {
|
await Promise.all(
|
||||||
console.log(`Refreshing ${name}`);
|
Object.entries(feeds).map(async ([name, url]) => {
|
||||||
const res = await fetch(url);
|
console.log(`Refreshing ${name}`);
|
||||||
const txt = await res.text();
|
const res = await fetch(url);
|
||||||
await writeFile(join("cached-feeds/", `${name}.xml`), txt);
|
const txt = await res.text();
|
||||||
}
|
await writeFile(join("cached-feeds/", `${name}.xml`), txt);
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Reference in a new issue