(buffer: ArrayBuffer)
| 20 | * Uses chunking for better performance with large files |
| 21 | */ |
| 22 | export const arrayBufferToBase64 = (buffer: ArrayBuffer): string => { |
| 23 | let binary = ""; |
| 24 | const bytes = new Uint8Array(buffer); |
| 25 | const chunkSize = 0x8000; |
| 26 | |
| 27 | for (let i = 0; i < bytes.length; i += chunkSize) { |
| 28 | const chunk = bytes.subarray(i, i + chunkSize); |
| 29 | binary += String.fromCharCode(...chunk); |
| 30 | } |
| 31 | |
| 32 | return btoa(binary); |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * Extract skill name from ZIP path (e.g. "skills/my-skill.zip" -> "my-skill") |
no outgoing calls
no test coverage detected