1

I created a script to grab specific files from GitHub repository via their API and save them locally. My issue is that each time I run this script, I want to know if that file has changed. I found a way to do this by comparing the SHA value returned when you make the request to the API, but this way is kind of inefficient because to get that SHA value I have to download the file, so in that way I'm always downloading the file and that is what I don't want.

So if anybody knows how to check if the file has changed without downloading it again please let me know.

Morgan Thrapp
  • 9,748
  • 3
  • 46
  • 67
Ordani Sanchez
  • 341
  • 2
  • 4
  • 12
  • 2
    Possible duplicate of [How do I get the "sha" parameter from GitHub API without downloading the whole file?](http://stackoverflow.com/questions/26203603/how-do-i-get-the-sha-parameter-from-github-api-without-downloading-the-whole-f) – Morgan Thrapp Sep 09 '16 at 19:46
  • You're on the right path with comparing SHAs of the files. You can use the method I linked to download the SHA without downloading the whole file. – Morgan Thrapp Sep 09 '16 at 19:47
  • Thanks men, i was looking but i do not found that one – Ordani Sanchez Sep 09 '16 at 20:07

0 Answers0