mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
feat:下载、删除图片资源
This commit is contained in:
parent
65652f87ef
commit
b450b7f08b
8 changed files with 180 additions and 7 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue