Have you ever wanted to get the contents of a GitHub file via JavaScript? If so I wrote the following function which gives you the ability to get the contents of a file or of a directory:

Here is an example of using the above function:

And here is another example which shows how to specify the branch name:

Feel free to use this function in your projects. Happy coding! 😎

Categories: BlogJavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *