-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub
More file actions
36 lines (18 loc) · 813 Bytes
/
github
File metadata and controls
36 lines (18 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(async()=>{
// "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
// /repos/{owner}/{repo}/git/blobs/{file_sha}
// https://api.github.com/repos/*owner*/*repo*/contents/*path*
//var token = '';
var headers = { accept:'application/vnd.github+json',
//authorization:`Bearer ${token}`
};
var user = 'javascript-2020';
var repo = 'libs';
var path = 'html/github/github.html';
var url = `https://api.github.com/repos/${user}/${repo}/contents/${path}`;
var res = await fetch(url,{headers});
var json = await res.json();
var b64 = json.content;
var txt = window.atob(b64);
console.log(txt);
})();