3 ms·
Why give that elaborate command line call instead of the clearer, simpler one in the example? curl --upload-file ./hello.txt https://transfer.sh/hello.txt
by scrollaway 11y ago
Why give that elaborate command line call instead of the clearer, simpler one in the example?
curl --upload-file ./hello.txt https://transfer.sh/hello.txt
In any case - cool! Good domain name too.
- waterhouse 11y agoI think the point is to illustrate that you can pipe things into it. There exist programs that work on files, and work much worse or not at all on standard input; this example thus demonstrates more power. (Though, alluded to below, the "-X PUT" may be totally superfluous.)
- nmat 11y agoThe pipe is into curl, has nothing to do with the website itself
- hk__2 11y agoThe website must support the feature. With `--upload-file` curl sends the `Content-Length` header; with the pipe it doesn’t.
- cbd1984 11y agoYou can do that with pure pipes, without cat: foo < input This replaces foo's stdin with a pipe reading from input.
- deleted 11y ago[deleted]
- jkbr 11y agoOr like this with HTTPie[0]: http PUT https://transfer.sh/hello.txt < ./hello.txt [0] http://httpie.org http://httpie.org
- reustle 11y agoBecause unlike these other examples, this one requires you to install something
- jkbr 11y ago"requires you to install something" is relative, depending on what's installed on your system. This example is a continuation of the 'elaborate vs. simpler command' theme of this thread for people who prefer HTTPie.
- cscheid 11y agoJust FYI, it would have been helpful if you had disclosed that you're the author of HTTPie.