mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
data: 添加HAKUSH数据下载/建模
This commit is contained in:
parent
d082c87809
commit
1c4798f9b8
7 changed files with 491 additions and 9 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import path from 'path';
|
||||
import { checkFile } from './core.js';
|
||||
import { getResourceRemotePath } from '../assets.js';
|
||||
import * as MysURL from '../mysapi/api.js';
|
||||
import * as MysURL from '../assets/mysurl.js';
|
||||
import * as HakushURL from '../assets/hakushurl.js';
|
||||
import * as LocalURI from './const.js';
|
||||
/**
|
||||
* 下载米游社图片
|
||||
|
|
@ -55,3 +56,20 @@ export const downloadResourceImage = async (
|
|||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 下载Hakush文件
|
||||
* @param {keyof HakushURL} base 远程地址
|
||||
* @param {keyof LocalURI} localBase 本地地址
|
||||
* @param {string} filename 文件名
|
||||
*/
|
||||
export const downloadHakushFile = async (base, localBase, filename = '') => {
|
||||
base = HakushURL[base];
|
||||
localBase = LocalURI[localBase];
|
||||
const finalPath = path.join(localBase, filename);
|
||||
let url = base;
|
||||
if (filename) {
|
||||
url += `/${filename}`;
|
||||
}
|
||||
return checkFile(url, finalPath);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue