4 ms·
It also buffers the downloaded data completely into memory last time I checked. So downloading a file bigger than the available RAM just doesn't work and you ha
by Lariscus 10mo ago
It also buffers the downloaded data completely into memory last time I checked. So downloading a file bigger than the available RAM just doesn't work and you have to use WebClient instead.
Another fun one is Extract-Archive which is painfully slow while using the System.IO.Compression.ZipFile CLR type directly is reasonably fast. Powershell is really a head scratcher sometimes.
- AHTERIX5000 10mo agoYep. And 'wget' is often alias for WebRequest in PowerShell. The amount of footguns I ran into while trying to get a simple Windows Container CI job running, oh man
- ycombinatrix 10mo ago"curl" being aliased to "Invoke-WebRequest" is also a massive dick move
- pixl97 10mo agoyea, curl.exe and curl are two different commands on windows. Fun stuff.
- jodrellblank 10mo agoNot "on Windows". In PowerShell 5. PowerShell core removed the curl alias 9 years ago.
- fourthark 10mo agoBut PowerShell 5.1 is still the one that ships with Windows.
- ycombinatrix 10mo agoI do still find Invoke-WebRequest useful for testing, because it is magically able to reuse TCP connections whereas curl always opens a new connection per request.
- jodrellblank 10mo agoIt's a completely new shell, new commands for everything, no familiar affordances for common tasks, so they add user-configurable, user-removable aliases from DOS/macOS/Linux so that people could have some on-ramp, something to type that would do something. That's not a dick move at all, that's a helpful move. Harassing the creator/team for years because a thing you don't use doesn't work the way you want it to work? That is. They removed it in PowerShell core 9 years ago! 9 years! And you're still fixated on it!
- ycombinatrix 10mo agoIt is still present in powershell on my up to date windows 11 machine today, so it is disingenuous for you to claim the alias was removed 9 years ago. It is 100% still being shipped today. The alias confuses people that are expecting to run curl when they type "curl" (duh) and also causes headaches for the actual curl developers, especially when curl is legitimately installed! Why the hostile tone? Pretty rude of you to claim I'm fixated on the issue for years and harassing the powershell development team with zero evidence.
- jodrellblank 10mo agoWhen you open powershell it says something like “Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows https://aka.ms/PSWindows” Isn’t it disingenuous to claim it is “up to date” when you know there’s a new version and aren’t using it? > “The alias confuses people that are expecting to run curl when they type "curl" (duh)” Yes, once, until you learn what to do about it. Which is … just like any other software annoyance. One you think people would get over decades ago. > “and also causes headaches for the actual curl developers.” Linux users can’t comprehend that the cURL developer doesn’t own those four letters. > “It has very little compatibility with the actual curl command.” It’s not supposed to have. As I said in another comment the aliases were added to be an on-ramp to PS. Why aren’t you also infuriated that “ls” isn’t compatible with “ls”? Because you use the full command name in scripts? Do that with invoke-webrequest. Because you expect command to behave different in PS? Do that with curl.
- jeroenhd 10mo agoThe download being cached in RAM kind of makes sense, curl will do the same (up to a point) if the output stream is slower than the download itself. For a scripting language, I think it makes sense. Microsoft deciding to alias wget to Invoke-WebRequest does make for a rather annoying side effect, but perhaps it was to be expected as all of their aliases for GNU tools are poor replacements. I tried to look into the whole Expand-Archive thing, but as of https://github.com/PowerShell/Microsoft.PowerShell.Archive/compare/f91fb19c42dc1b119247d529c1ff6b0f456ff7d5..b783599348e726069f17b90bd490f4f856f661f6#diff-52ad6a50c0d0679b5178ac5bbf62af84ca1f3c191447ba087524850c57e4b4a1 https://github.com/PowerShell/Microsoft.PowerShell.Archive/c... I can't even find the Expand-Archive cmdlet source code anymore. The archive files themselves seem to have "expand" be unimplemented. Unless they moved the expand command to another repo for some reason, it looks like the entire command will disappear at one point? Still, it does look like Expand-Archive was using the plain old System.IO.Compression library for its file I/O, though, although there is a bit of pre-processing to validate paths existing and such, that may take a while.
- mort96 10mo ago> curl will do the same (up to a point) if the output stream is slower than the download itself That "up to a point" is crucial. Storing chunks in memory up to some max size as you wait for them to be written to disk makes complete sense. Buffering the entire download in memory before writing to disk at the end doesn't make sense at all.
- jeroenhd 10mo agocurl's approach will lead to partial and failed downloads. When a client stops accepting new data, servers tend to close the connection after a while. There are smoother ways to deal with this (i.e. reduce download rate by faking dropped packets to output speed), but if you just want a simple download command, I think both simple solutions are fine. If the download doesn't fit in RAM, it'll end up swapped out and effectively cached to disk anyway.
- mort96 10mo ago
- DHowett 10mo agotar.exe, however, beats both of those in terms of archive format support and speed.