如果文件查看器可以使用curl
,则可以使用gh api
获取文件的内容URL,并将其下载,如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.