-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Invoke-WebRequest -OutLeaf #20010
Copy link
Copy link
Open
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Summary of the new feature / enhancement
I would like an ability to download a file with
Invoke-WebRequestwithout explicitly providing its name, same as withcurl -O. The filename should be deduced from the uri, equivalent to-Uri $Uri -OutFile (Split-Path $Uri). If the uri contains query parameters, they are either discarded (test.txt?param=valueresults intest.txt), or an error should be given.Motivating example can be seen in
Invoke-WebRequestexample #8, the filename is typed twice for every file - once inUriand once inOutFile.Additionally, I think that
-OutLeafwithout-PassThrushould return the full resolved path to the downloaded file, so that it can be stored or piped intoStart-ProcessorInvoke-Commandfor immediate execution (useful for e.g. installers).Similar proposals were made in:
I agree with the latter, that
-OutDirectorycould be an alternative API, so that you can getInvoke-WebRequest -OutLeafwithInvoke-WebRequest -OutDirectory ., while also allowing to download files with implicit filename to a different directory.Opens:
Invoke-WebRequest example.com/file%20with%space.txt -OutLeafresult infile%20with%20space.txtorfile with space.txt? I would say latter,curlsays former.Proposed technical implementation details (optional)
No response