Downloads and analysis with HTTPie
|
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.
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 https://openclipart.org/pdf/203567/1414101992.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.
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.
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 6
(incl. VAT)