Downloads and analysis with HTTPie

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Downloading Files

You can use the -d option to download files. Figure 4 shows the output of this command. You'll see the download progress in the terminal. The header details are interesting. They recognize the type of payload, as well as the size and date of the last process.

Figure 4: Downloading a file with HTTPie.

You can resume interrupted downloads without restarting, as long as the server has been configured to handle partial content. To do this, assign your own filename to the download (-o FILENAME ) and also set the -c option. The full command, in the right order, would look something like this:

http -dco unicorn.pdf

WebDAV Download

The option -a also allows you to connect to Web Distributed Authoring and Versioning (WebDAV) services and download files. Figure 5 shows how to get started. For example, using the -v option, you can use the get request with a resource.

Figure 5: Download a file from a WebDAV resource.

Download the contents of a WebDAV directory into your working directory using -d , and examine it in a browser, such as w3m . Naturally, you can parse the output through pipes instead and then, for instance, start to download very specific data.

Deletion is performed using the HTTP method delete . You must specify the complete resource, so wildcard characters won't work. In Figure 6, you can see http with delete in action.

Figure 6: Deleting a file in the WebDAV directory.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content