1

Octokit allows me to easily retrieve the list of files in a given folder like so:

var directoryContent = await _githubClient.Repository.Content.GetAllContents("MyUsername", "MyProject", "TheFolderName").ConfigureAwait(false);

Unfortunately, the Content property for each file is null which means that I have to loop through the list of files and retrieve each one separately like so:

foreach (var file in directoryContent)
{
    var fileWithContent = await _githubClient.Repository.Content.GetAllContents("MyUsername", "MyProject", file.Path).ConfigureAwait(false);
    ... do something with the content ...
}

Is there a more efficient way to get the content of all files in a given folder?

desautelsj
  • 3,587
  • 4
  • 37
  • 55

1 Answers1

-1

Just for reference: This is on purpose. If you read a whole directory and load all the content in one step it's huge load. So, the first call skips the content (Content property is null). The second step requests just this file and then the content is present.

Only thing I'm still missing is a method that can return just one result instead of a list if I pull a single file.

Joerg Krause
  • 1,759
  • 1
  • 16
  • 27