storageService.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. export declare function ensureDir(dir: string): void;
  2. /**
  3. * 从填色详情页 URL 中提取素材 ID 并拼接 zip 下载地址。
  4. *
  5. * 输入:https://color2.jccytech.cn/app/zh/pages/detail/6a154397957ac783bac98e10
  6. * 输出:https://color2.jccytech.cn/zips/v2/number_mini/1501/6a154397957ac783bac98e10.zip
  7. */
  8. export declare function parseDetailUrl(detailUrl: string): {
  9. id: string;
  10. zipUrl: string;
  11. } | null;
  12. /**
  13. * 下载远程文件到 Buffer
  14. */
  15. export declare function downloadFile(url: string): Promise<Buffer>;
  16. /**
  17. * XOR 解密 zip 文件。
  18. *
  19. * 密钥 = 文件名(不含扩展名),即素材 ID。
  20. * 对整个文件逐字节异或解密,密钥循环使用。
  21. */
  22. export declare function xorDecryptBuffer(encrypted: Buffer, key: string): Buffer;
  23. export declare function getCreativeAssetsDir(storageDir: string, creativeId: string): string;
  24. export declare function getBuildOutputDir(storageDir: string, creativeId: string, buildId: string): string;
  25. export declare function scanAssetFiles(assetsDir: string): {
  26. config: boolean;
  27. page: boolean;
  28. map: boolean;
  29. special: string | null;
  30. };
  31. //# sourceMappingURL=storageService.d.ts.map