I need create a file viewer in html, because html can open only txt. Thing like I need - raw githubusercontent. How it works?
Asked
Active
Viewed 121 times
1 Answers
0
If your file viewer can use curl
, you can use gh api
to get the content URL of a file, and download it, as seen here:
API_URL=https://api.github.com/repos/owner/repo/contents/path/file.ext
curl $(gh api $API_URL --jq .download_url) -o file.ext
That would simulate what raw.githubusercontent.com
does.
And not just for .txt
files.

VonC
- 1,262,500
- 529
- 4,410
- 5,250