powershell [System.Net.WebRequest] with System.IO.StreamReader in a While Loop

Job ID: 34342514

Budget: $15 – $25 AUD

This project is to write a Powershell function that will do a Web request with a GET method to a specified website. The only catch is I want a progress displayed using Write-Host of the progress like "15% Downloaded".

What I figured out is that you need to use [System.Net.WebRequest] and then within a "While" loop use System.IO.StreamReader Read to get each chunk. Within the While Loop you can output the percentage or bytes read or something indicating that you are reading the website contents.

I have attached a few references that show writing using this method, but unfortunatly I don't have the skills to rewrite them:

https://gist.github.com/nolim1t/271018
https://github.com/PowerShell/PowerShell/issues/13721
https://qa.wujigu.com/qa/?qa=722434/powershell-upload-big-files-via-http
https://stackoverflow.com/questions/20993350/tracking-progress-of-httpwebrequest-and-httpwebresponse
Related categories: .NET C# Programming Powershell