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 3,566 times
3
jj008
- 913
- 2
- 18
- 39
1 Answers
5
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
- 178
- 1
- 11