feat:下载、删除图片资源

This commit is contained in:
bietiaop 2024-07-14 23:36:17 +08:00
parent 65652f87ef
commit b450b7f08b
8 changed files with 180 additions and 7 deletions

View file

@ -80,16 +80,13 @@ export const getSquareBangboo = async bangbooId => {
* @returns Promise<string>
*/
export const getWeaponImage = async id => {
logger.debug('getWeaponImage', id);
const name = weapon.IDToWeaponFileName(id);
logger.debug('getWeaponImage', name);
const filename = `${name}.png`;
const weaponPath = path.join(ZZZ_WEAPON_PATH, filename);
if (fs.existsSync(weaponPath)) return weaponPath;
const url = await getResourceRemotePath('weapon', filename);
const savePath = weaponPath;
const download = await downloadFile(url, savePath);
logger.debug('getWeaponImage', download);
return download;
};