Created
          May 6, 2021 18:42 
        
      - 
      
 - 
        
Save zionyx/ec5e2341dd7172bd5a0644e6e49d0664 to your computer and use it in GitHub Desktop.  
    Get the size of a public github repository before downloading
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # 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