(items: JsdelivrFile[], currentPath = "")
| 350 | } |
| 351 | |
| 352 | function flattenJsdelivrTree(items: JsdelivrFile[], currentPath = ""): string[] { |
| 353 | let filePaths: string[] = []; |
| 354 | for (const item of items) { |
| 355 | const itemPath = currentPath ? `${currentPath}/${item.name}` : item.name; |
| 356 | if (item.type === "file") { |
| 357 | filePaths.push(itemPath); |
| 358 | } else if (item.type === "directory" && item.files) { |
| 359 | filePaths.push(...flattenJsdelivrTree(item.files, itemPath)); |
| 360 | } |
| 361 | } |
| 362 | return filePaths; |
| 363 | } |
| 364 | |
| 365 | export function getJsdelivrTotalSize(items: JsdelivrFile[]): number { |
| 366 | let total = 0; |
no test coverage detected