MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / readJsonArray

Function readJsonArray

fadian/fadian.ts:56–64  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

54// 下载并缓存配置文件
55async function downloadConfigFile(filename: string): Promise<void> {
56 try {
57 const url = baseRepoURL + filename;
58 const localPath = path.join(ASSET_PATH, filename);
59
60 const response = await axios.get(url);
61 fs.mkdirSync(ASSET_PATH, { recursive: true });
62 fs.writeFileSync(localPath, JSON.stringify(response.data, null, 2));
63
64 // 更新缓存
65 configCache[filename] = Array.isArray(response.data) ? response.data : [];
66 } catch (error) {
67 console.error(`下载配置文件失败: ${filename}`, error);

Callers 1

ensureConfigFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected