Transfer Files via Web: curl

Did you ever have this situation: You’re SSH’ed into a box. Or worse, you’re on some corporate *hmmkkmm slow* VPN, over which you SSH’ed into a box. Or worse, corporate VPN, use RDP to some Windows server, on that opening some tool thing which has a console to a virtual machine? And you need to want to transfer some 10’s of megs or more debug data out?
If you’re lucky, you get a slow transfer going. If you’ve bad luck, there no sane way to directly transfer the data.
Then you waste time trying to use a ‘send files via web’ service…oh god. And in the end you might move data via some server you control =(.

Why can’t I just user CURL?

Yes, why can’t I just use use CURL. Like, I ‘upload’ the data via curl, and download it at the other end. Like a simple pipe. No signing up, sending emails which links to the ‘large file’, no need for a browser.

I basically just wanted something like.

gamlor@machine-a: cat my-data | curl
gamlor@machine-b: curl > my-data

Nothing more. It does need to store it. Just a file transfer!

File Transfer Trouble

File Transfer Trouble


So I built it for myself =). And here it is: Röhrli, pipe files via web: .

You start by pointing CURL at it. Do not miss the S in httpS =). It will then give you a guide. A example:


>    Röhrli: Pipe your files via Web.
> ⁼
>    cURL guide:
>    Basics:
>    - Shows this help text. (or web page in a browser)
>        curl
>    - Pipe a file to röhrli. It will respond with an URL:
>        cat my-file | curl -N --data-binary @-
>    - Gzip if needed:
>        cat my-file | gzip | curl -N --data-binary @-
>    - The request will give you an URL. Then read from it on another place:
>        curl {the-url-returned} > my-file
>    Any question? Email: Twitter: @gamlerhart

Then you pipe your file / data to curl. As told by the instruction. After that, you’re receive instructions how do download the data.
Do not stop CURL. Röhrli does not store the file on the server. It just transfers data from the uploader to the downloader.

echo data > test-file.txt
cat test-file.txt | curl -N --data-binary @-

>    You're pipe was created at
>    Download it with:
>    - curl > my-file.txt
>    If you uploaded gzipped, decompress:
>    - curl | gzip -d > my-file.txt
>    This pipe is streaming. No data is permanently stored on the server.
>    Do not quit (Ctrl-C/D) before the transfer is done.
>    Verify that the download is complete and correct with: sha1sum my-file.txt
>    Start your download now. We're waiting for the download to start for 10 minutes
>    ......

As you see, you get a unique link. You now can download it =). You might want to double check the download with something like sha1sum.

curl > my-file.txt

>    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                    Dload  Upload   Total   Spent    Left  Speed
>    100     5  100     5    0     0      2      0  0:00:02  0:00:02 --:--:--     2

And you’re done!
Up and downloading of course also work with a browser =).

That’s about it. If you find a bug or have wishes, let me know =)

Tagged on: , ,