5 ms·
> “I think you could replace 99% of the uses of Curl … with like 100 lines of Python or Rust or Go” Assuming this is the "99%" usage pattern: curl -O foo.
by ddtaylor 4y ago
> “I think you could replace 99% of the uses of Curl … with like 100 lines of Python or Rust or Go”
Assuming this is the "99%" usage pattern:
curl -O foo.txt https://example.com/foo.txt
Then, yes.
- tyingq 4y agoOr, with a dependency on libcurl :) Also, it's not immediately obvious in the various libraries how to do something right. Most python/requests examples you'll find to do that simple "download a file", for example, would run out of memory on a large file.
- raincole 4y ago100 lines is such an amateur number. I can actually do this in 1 lines of shell. curl -O $1 $2 Checkmate 100line python guy!
- ddtaylor 4y agoIt's worth noting that Microsoft actually does shim "curl" in Powershell to basically be a light wrapper around the "Invoke-WebRequest" object. Is it a full drop-in replacement for curl? Nope, but it does replace it in the simple context(s) of stuff like "curl -O foo bar"
- raincole 4y agoPowershell is really weird in the sense that I can sometimes use Unix-like command like cp, mv, rm... I know it's probablly a completely different thing behind the curtain but it's amusing.
- alias_neo 4y agoIn the defense of some of the particularly jerk-inducing ones, they're conflating libcurl with curl. Sure if you want to fetch a file from the internet you could do it with one line (see the person I'm replying to); I'd love to see the look on some of these people's faces when they find out that tool/software/whatever they use is actually using libcurl under the hood. Good luck even getting on the internet in the first place without that router, switch, PC, modem or anything else that's also running curl/libcurl. I don't know whether it's just my age showing, but thinking you could do anything remotely like curl in 3 days is .... well, my 1 year old probably talks more sense when he says "no".
- ddtaylor 4y ago> I'd love to see the look on some of these people's faces when they find out that tool/software/whatever they use is actually using libcurl under the hood. Python dependencies (does not include curl) https://devguide.python.org/getting-started/setup-building/index.html https://devguide.python.org/getting-started/setup-building/i... The "requests" module in Python (does not use curl) https://github.com/psf/requests https://github.com/psf/requests
- woodrowbarlow 4y agoyes, python and some other languages have more-or-less re-implemented parts of libcurl. requests is one example created by a particularly prolific author and it has been evolving for over a decade. that's perfect evidence that, no, a common developer cannot "re-write" curl in a few days.
- em-bee 4y agoor wget https://example.com/foo.txt https://example.com/foo.txt like those 99% i never had a use for curl because wget covers all my use cases including some that curl doesn't. but where curl is a swiss-army-knife, wget is a simple hunters or sailors knife. it cuts, and that's all it does. everyone who complains about curl is not taking advantage of its features and should be using wget instead of complaining.