Skip to content

Instantly share code, notes, and snippets.

@zionyx
Created May 6, 2021 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zionyx/ec5e2341dd7172bd5a0644e6e49d0664 to your computer and use it in GitHub Desktop.
Save zionyx/ec5e2341dd7172bd5a0644e6e49d0664 to your computer and use it in GitHub Desktop.
Get the size of a public github repository before downloading
# https://gist.github.com/dingzeyuli/f07c126b74371adba4b7dbe181cb57d2
# Tested on PowerShell-Core 7.1.3
If ( 'https://github.com/torvalds/linux.git' -match '([^/]+/[^/]+?)(?:\.git)' ) { Invoke-RestMethod "https://api.github.com/repos/$($Matches[1])" | Select-Object -Property size }
# Output: (in bytes)
# size
# ----
# 3262068
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment