Get file size (e.g. README)



It allows to get the contents of a file or directory in a repository (like README):

  "type": "file",
  "encoding": "base64",
  "size": 5362,
  "name": "",
  "path": "",
  "content": "encoded content ...",
  "sha": "3d21ec53a331a6f037a91c368710b99387d012c1",
  "url": "",
  "git_url": "",
  "html_url": "",
  "download_url": "",
  "_links": {
    "git": "",
    "self": "",
    "html": ""

How can I do that in GraphQL API?

I managed to get down to the level of:

  repository(owner: "nickvanw", name:"ircx") {
    object(expression: "") {
      {... on Tree {entries { HERE, HOW TO SPECIFY SIZE }}

from, but can’t get any further.

Please help. Thx!


I don’t think we have the ability to provide file contents via the GraphQL API… at least not without doing some things that we shouldn’t!

My recommendation would be to use the v3 API to get file contents, or (if there’s a lot of it) to clone the repository with a depth of 1 and get the files from the filesystem.