Skip to content

Commit c2339e2

Browse files
committed
feat: initial version
1 parent 391acc4 commit c2339e2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

get-file-content.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Get contents of a file
3+
*
4+
* @param {import('@octoherd/octokit').Octokit} octokit
5+
* @param {string} owner
6+
* @param {string} repo
7+
* @param {string} path
8+
*
9+
* @returns {string}
10+
*/
11+
export async function getFileContent(octokit, owner, repo, path) {
12+
const { data } = await octokit.request(
13+
"GET /repos/{owner}/{repo}/contents/{path}",
14+
{
15+
mediaType: {
16+
format: "raw",
17+
},
18+
owner,
19+
repo,
20+
path,
21+
}
22+
);
23+
24+
return data;
25+
}

0 commit comments

Comments
 (0)