( filePath: string )
| 139 | * Fetch raw file content from GitHub |
| 140 | */ |
| 141 | export async function fetchFileContent( |
| 142 | filePath: string |
| 143 | ): Promise<string | null> { |
| 144 | try { |
| 145 | const response = await fetch(`${REPO_BASE_URL}/${filePath}`); |
| 146 | if (!response.ok) throw new Error(`Failed to fetch ${filePath}`); |
| 147 | return await response.text(); |
| 148 | } catch (error) { |
| 149 | console.error(`Error fetching file content:`, error); |
| 150 | return null; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Copy text to clipboard |