How to get total no of files and total no of files from github apis?I can get it from shell script but want to get it via api.Is there any possible way?
I’m not a GitHub API expert but I have used it for a few things.
I do not think there is a direct way to get the number of files in a repository. But it is possible to “get repo contents” and navigate the results to determine a file count and if there are sub-directories to look into. Chances are the shell script you mentioned is calling the same API.
The API command is documented here - https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#get-repository-content
If successful, the response to the API command is an array of objects that describe each file or folder. The
type field of each object will be either
dir. Then it’s easy to count them yourself and use the info provide to get the URL for the contents of the folders.