🎨 Optimize the use of CLI.

This commit is contained in:
Tw93
2023-06-22 20:56:15 +08:00
parent 22e3efea49
commit e1cd40277f
9 changed files with 79 additions and 49 deletions

6
bin/options/icon.ts vendored
View File

@@ -25,11 +25,10 @@ export async function handleIcon(options: PakeAppOptions) {
export async function downloadIcon(iconUrl: string) {
try {
const iconResponse = await axios.get(iconUrl, {
responseType: 'arraybuffer',
});
const iconResponse = await axios.get(iconUrl, { responseType: 'arraybuffer' });
const iconData = await iconResponse.data;
if (!iconData) {
return null;
}
@@ -42,6 +41,7 @@ export async function downloadIcon(iconUrl: string) {
const { path: tempPath } = await dir();
const iconPath = `${tempPath}/icon.${fileDetails.ext}`;
await fsExtra.outputFile(iconPath, iconData);
return iconPath;
} catch (error) {
if (error.response && error.response.status === 404) {