pbatard / Fido

A PowerShell script to download Windows or UEFI Shell ISOs
GNU General Public License v3.0
2.41k stars 228 forks source link

Invoke-WebRequest #56

Closed Acenl12 closed 1 year ago

Acenl12 commented 1 year ago

I saw that Invoke-WebRequest is being used in this script, I would suggest using Start-BitsTransfer: With Invoke-WebRequest, the file is buffered in the memory first, before it's written to the disk. A faster and better way is to use the Start-BitsTransfer cmdlet in PowerShell. This cmdlet allows you to queue files, set priority (useful for bandwidth limitation), can run in the background and download multiple files asynchronous. By default, the download jobs run in the foreground consuming the maximum bandwidth available. You can change this by setting the priority of the job:

pbatard commented 1 year ago

I saw that Invoke-WebRequest is being used in this script,

I'm assuming that your concern is about the final download invoked by the commandline version of the script, and not the multiple Invoke-WebRequest that we use prior to that and that only return small fragments of HTML, and for which we have zero use for non-memory buffering, priority, background tasks, multiple or asynchronous tasks.

Since commandline is not the prime focus of Fido (again, Fido is almost entirely designed for use with Rufus, and anything commandline is added in an ad-hoc, "I don't really want to have to invest time supporting this" fashion) I'm not sure it makes much sense to change something that is working well enough into something else, but maybe next time I update commandline, I'll switch that final download to Start-BitsTransfer.

In the context of Rufus however, which only retrieves the download URL to either perform the download in app, or hand it off to a browser, I am hard pressed to see how switching any of the Invoke-WebRequest calls we use to Start-BitsTransfer is going to be of any benefit.

For now, I will leave that request open... which it may remain for a while.

Acenl12 commented 1 year ago

I saw that Invoke-WebRequest is being used in this script,

I'm assuming that your concern is about the final download invoked by the commandline version of the script, and not the multiple Invoke-WebRequest that we use prior to that and that only return small fragments of HTML, and for which we have zero use for non-memory buffering, priority, background tasks, multiple or asynchronous tasks.

Since commandline is not the prime focus of Fido (again, Fido is almost entirely designed for use with Rufus, and anything commandline is added in an ad-hoc, "I don't really want to have to invest time supporting this" fashion) I'm not sure it makes much sense to change something that is working well enough into something else, but maybe next time I update commandline, I'll switch that final download to Start-BitsTransfer.

In the context of Rufus however, which only retrieves the download URL to either perform the download in app, or hand it off to a browser, I am hard pressed to see how switching any of the Invoke-WebRequest calls we use to Start-BitsTransfer is going to be of any benefit.

For now, I will leave that request open... which it may remain for a while.

Yes correct the final download of the ISO. I use it without Rufus to download just the windows iso.