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") {
|
||||
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);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue