繁体   English   中英

使用GitHub API检索具有特定扩展名的文件

[英]Using GitHub API to retrieve files with specific extension

我想从给定的git仓库中获取文件列表。 例如,我想从给定的git存储库中获取所有* .js文件。 如何使用GitHub API满足上述要求? 还是有什么方法可以从git存储库中获取* .js文件列表?

在这里,我做了什么以找出我自己的存储库中的所有.js文件。

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

来源: https : //developer.github.com/v3/search/#search-code

编辑

这是我在回购的master分支中查找“ .classpath”文件的路径所要做的。

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

消息来源: https//developer.github.com/v3/repos/contents/#get-contents

但是 ,git以上的API响应具有base64编码的内容。 因此,要获取原始数据,应使用以下一项。

curl -i "https://raw.githubusercontent.com/vnation/NewsAggregator/master/.classpath"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM