I am converting some bash downloader scripts to PowerShell, and I am using Invoke-WebRequest
instead of curl
to eliminate external dependencies (so curl for Windows is not an option).
Most curl options can be replicated with Invoke-WebRequest but I could not find a way to replicate the behavior of
curl -C - <url> -o <filename>
From the curl manpage:
-C, --continue-at <offset>
Continue/Resume a previous file transfer at the given offset.
The given offset is the exact number of bytes that will be skipped, counting
from the beginning of the source file before it is transferred to the destination.
If used with uploads, the FTP server command SIZE will not be used by curl.
Use "-C -" to tell curl to automatically find out where/how to resume the transfer.
It then uses the given output/input files to figure that out.
If this option is used several times, the last one will be used.
I did check the docs for Invoke-WebRequest but wasn't able to find a matching option.
Invoke-RestMethod
. it has a-Resume
parameter that seems likely to do what you want. ///// otherwise, use a windows versioncurl.exe
.