Hacker News new | past | comments | ask | show | jobs | submit login

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.



I 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.)


The pipe is into curl, has nothing to do with the website itself


The website must support the feature. With `--upload-file` curl sends the `Content-Length` header; with the pipe it doesn’t.


You can do that with pure pipes, without cat:

    foo < input
This replaces foo's stdin with a pipe reading from input.


Or like this with HTTPie[0]:

    http PUT https://transfer.sh/hello.txt < ./hello.txt
[0] http://httpie.org


Because unlike these other examples, this one requires you to install something


"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.


Just FYI, it would have been helpful if you had disclosed that you're the author of HTTPie.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: