I'm trying to make a request to the Github api and get the content (code) from a file that is in an open repo. I did a simple curl -i
on the terminal and it returned some content that is encoded (according to the docs). How can I decode that content? And possible put the code in the correct format (indentations, etc.) when I'm outputting it on an html textarea?
Asked
Active
Viewed 5,439 times
4

jj008
- 1,033
- 3
- 23
- 48
1 Answers
7
The GitHub API documentation for repository contents states that "These API methods let you retrieve the contents of files within a repository as Base64 encoded content." (https://developer.github.com/v3/repos/contents/) You need to perform a base 64 decode.
Here's an example of how to do it in Python: Python base64 data decode

dustintheglass
- 197
- 1
- 11