Skip to content

Commit

Permalink
Fix folder creation for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikescops committed Feb 28, 2024
1 parent e62b51c commit c452d3d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions website/tools/fetch-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ async function fetchDomainInfo(domain, debug = false) {
const response = await axiosInstance.get(bestQualityIcon, { responseType: 'arraybuffer' });
const fileExtension = bestQualityIcon.split('.').pop();
// if icon folder does not exist, create it
fs.access('public/icons').catch(() => {
fs.mkdir('public/icons');
});
await fs.mkdir('public/icons').catch(() => { });

iconPath = `icons/${domain}.${fileExtension}`;
await fs.writeFile(`public/${iconPath}`, response.data);
if (debug) console.log(`Icon saved to ${iconPath}`);
Expand Down

0 comments on commit c452d3d

Please sign in to comment.