functions/web/Get-GithubArchive.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
function Get-GithubArchive() { [CmdLetBinding()] param( [parameter(Mandatory = $true)] [string]$Url, [parameter(Mandatory = $true)] [string]$OutFilePath, [parameter(Mandatory = $true)] [string]$AuthToken ) begin { $wc = New-Object System.Net.WebClient $wc.Headers.Add('Authorization', "token $AuthToken") } process { $wc.DownloadFile($Url, $OutFilePath) } end { $wc.Dispose() } } |