🎨 Fix the bug of download icon

This commit is contained in:
Tw93
2023-08-28 19:15:23 +08:00
parent 76ee3a185e
commit 0c82b3ffd8
3 changed files with 59 additions and 57 deletions

View File

@@ -45,15 +45,19 @@ if (process.env.ICON && process.env.ICON !== '') {
process.exit(1);
}
axios
.get(process.env.ICON, { responseType: 'arraybuffer' })
.then(response => {
const downloadIcon = async () => {
try {
const response = await axios.get(process.env.ICON, { responseType: 'arraybuffer' });
console.log('>>>>>>> download icon response:', response);
fs.writeFileSync(iconFile, response.data);
console.log('>>>>>>> download icon is:', iconFile);
params = `${params} --icon ${iconFile}`;
})
.catch(error => {
} catch (error) {
console.error('Error occurred during icon download: ', error);
});
}
};
downloadIcon();
} else {
console.log("Won't download the icon as ICON environment variable is not defined!");
}