最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using GitHub API to retrieve files with specific extension - Stack Overflow

programmeradmin0浏览0评论

I want to get a list of files from given git repository. For an example, I want to get all *.js files from a given git repository. How can I use GitHub API to satisfy above requirement? or is there any way to get the list of *.js files from a git repository?

I want to get a list of files from given git repository. For an example, I want to get all *.js files from a given git repository. How can I use GitHub API to satisfy above requirement? or is there any way to get the list of *.js files from a git repository?

Share Improve this question asked Jan 10, 2018 at 16:27 MathuMathu 631 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Here, what I did to find out all .js file in my own repository.

curl -i "https://api.github./search/code?q=extension:js+repo:vnation/NewsAggregator"

source: https://developer.github./v3/search/#search-code

EDIT

This is what I did to find out the path of ".classpath" file in the master branch of my repo.

curl -i "https://api.github./repos/vnation/NewsAggregator/contents/.classpath"

SOURCE: https://developer.github./v3/repos/contents/#get-contents

However, git response above API with base64 encoded content. So, to get raw data you should use below one.

curl -i "https://raw.githubusercontent./vnation/NewsAggregator/master/.classpath"
发布评论

评论列表(0)

  1. 暂无评论