MCPcopy Create free account
hub / github.com/NiladriHazra/WhatToBuild / getFileContent

Method getFileContent

lib/github.ts:143–157  ·  view source on GitHub ↗
(owner: string, repo: string, path: string)

Source from the content-addressed store, hash-verified

141 }
142
143 async getFileContent(owner: string, repo: string, path: string): Promise<string | null> {
144 try {
145 const response = await axios.get(`${this.baseURL}/repos/${owner}/${repo}/contents/${path}`, {
146 headers: this.getHeaders()
147 });
148
149 if (response.data.content) {
150 return Buffer.from(response.data.content, 'base64').toString('utf-8');
151 }
152 return null;
153 } catch (error) {
154 console.error('GitHub file content error:', error);
155 return null;
156 }
157 }
158
159 async analyzeRepository(repo: GitHubRepo): Promise<RepoAnalysis> {
160 const [owner, repoName] = repo.full_name.split('/');

Callers 5

analyzeRepositoryMethod · 0.95
GETFunction · 0.95
GETFunction · 0.95
GETFunction · 0.95
GETFunction · 0.95

Calls 1

getHeadersMethod · 0.95

Tested by

no test coverage detected